Alternatives to InvokeMethod

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ringo

    Alternatives to InvokeMethod

    I've created a component that takes a class as an input
    and executes methods on the class based on a set of text
    instructions. The instructions are the names of the
    methods to be executed and are different for each class
    passed in. I've been using InvokeMethod to do this and it
    works, but, it's TOO slow.

    I've used the "eval" method in Jscript to do this sort of
    thing and it doesn't seem to be as slow.

    I'm about to try dynamic compilation but it seems quite a
    bit more work (and is more likely to develop bugs).

    I'd appreciate any ideas to solve this problem.

    Thanks
    R
  • Armin Zingler

    #2
    Re: Alternatives to InvokeMethod

    "Ringo" <anonymous@disc ussions.microso ft.com> schrieb[color=blue]
    > I've created a component that takes a class as an input
    > and executes methods on the class based on a set of text
    > instructions. The instructions are the names of the
    > methods to be executed and are different for each class
    > passed in. I've been using InvokeMethod to do this and it
    > works, but, it's TOO slow.
    >
    > I've used the "eval" method in Jscript to do this sort of
    > thing and it doesn't seem to be as slow.
    >
    > I'm about to try dynamic compilation but it seems quite a
    > bit more work (and is more likely to develop bugs).
    >
    > I'd appreciate any ideas to solve this problem.[/color]


    If possible, the component, or the library containing the component, can
    define an interface that must be implemented in the class passed to the
    component. This requires select case blocks within the component to call the
    appropriate method depending on the instructions, but I think it should be
    faster than reflection.


    --
    Armin

    How to quote and why:



    Comment

    • Armin Zingler

      #3
      Re: Alternatives to InvokeMethod

      "Ringo" <anonymous@disc ussions.microso ft.com> schrieb[color=blue]
      > I've created a component that takes a class as an input
      > and executes methods on the class based on a set of text
      > instructions. The instructions are the names of the
      > methods to be executed and are different for each class
      > passed in. I've been using InvokeMethod to do this and it
      > works, but, it's TOO slow.
      >
      > I've used the "eval" method in Jscript to do this sort of
      > thing and it doesn't seem to be as slow.
      >
      > I'm about to try dynamic compilation but it seems quite a
      > bit more work (and is more likely to develop bugs).
      >
      > I'd appreciate any ideas to solve this problem.[/color]


      If possible, the component, or the library containing the component, can
      define an interface that must be implemented in the class passed to the
      component. This requires select case blocks within the component to call the
      appropriate method depending on the instructions, but I think it should be
      faster than reflection.


      --
      Armin

      How to quote and why:



      Comment

      • Ringo

        #4
        Re: Alternatives to InvokeMethod

        Thanks, Armin

        unfortunately, the objects can have any method name and
        the component will only know which methods to call from a
        text file. I can't recompile this component to add new
        interfaces and the objects being passed to it will always
        have there own set of methods.
        [color=blue]
        >-----Original Message-----
        >"Ringo" <anonymous@disc ussions.microso ft.com> schrieb[color=green]
        >> I've created a component that takes a class as an input
        >> and executes methods on the class based on a set of[/color][/color]
        text[color=blue][color=green]
        >> instructions. The instructions are the names of the
        >> methods to be executed and are different for each class
        >> passed in. I've been using InvokeMethod to do this and[/color][/color]
        it[color=blue][color=green]
        >> works, but, it's TOO slow.
        >>
        >> I've used the "eval" method in Jscript to do this sort[/color][/color]
        of[color=blue][color=green]
        >> thing and it doesn't seem to be as slow.
        >>
        >> I'm about to try dynamic compilation but it seems[/color][/color]
        quite a[color=blue][color=green]
        >> bit more work (and is more likely to develop bugs).
        >>
        >> I'd appreciate any ideas to solve this problem.[/color]
        >
        >
        >If possible, the component, or the library containing[/color]
        the component, can[color=blue]
        >define an interface that must be implemented in the[/color]
        class passed to the[color=blue]
        >component. This requires select case blocks within the[/color]
        component to call the[color=blue]
        >appropriate method depending on the instructions, but I[/color]
        think it should be[color=blue]
        >faster than reflection.
        >
        >
        >--
        >Armin
        >
        >How to quote and why:
        >http://www.plig.net/nnq/nquote.html
        >http://www.netmeister.org/news/learn2quote.html
        >
        >.
        >[/color]

        Comment

        • Ringo

          #5
          Re: Alternatives to InvokeMethod

          Thanks, Armin

          unfortunately, the objects can have any method name and
          the component will only know which methods to call from a
          text file. I can't recompile this component to add new
          interfaces and the objects being passed to it will always
          have there own set of methods.
          [color=blue]
          >-----Original Message-----
          >"Ringo" <anonymous@disc ussions.microso ft.com> schrieb[color=green]
          >> I've created a component that takes a class as an input
          >> and executes methods on the class based on a set of[/color][/color]
          text[color=blue][color=green]
          >> instructions. The instructions are the names of the
          >> methods to be executed and are different for each class
          >> passed in. I've been using InvokeMethod to do this and[/color][/color]
          it[color=blue][color=green]
          >> works, but, it's TOO slow.
          >>
          >> I've used the "eval" method in Jscript to do this sort[/color][/color]
          of[color=blue][color=green]
          >> thing and it doesn't seem to be as slow.
          >>
          >> I'm about to try dynamic compilation but it seems[/color][/color]
          quite a[color=blue][color=green]
          >> bit more work (and is more likely to develop bugs).
          >>
          >> I'd appreciate any ideas to solve this problem.[/color]
          >
          >
          >If possible, the component, or the library containing[/color]
          the component, can[color=blue]
          >define an interface that must be implemented in the[/color]
          class passed to the[color=blue]
          >component. This requires select case blocks within the[/color]
          component to call the[color=blue]
          >appropriate method depending on the instructions, but I[/color]
          think it should be[color=blue]
          >faster than reflection.
          >
          >
          >--
          >Armin
          >
          >How to quote and why:
          >http://www.plig.net/nnq/nquote.html
          >http://www.netmeister.org/news/learn2quote.html
          >
          >.
          >[/color]

          Comment

          Working...