Loading ...
Sorry, an error occurred while loading the content.

Re: ANN: multvals-3.5

Expand Messages
  • Hari Krishna Dara
    ... Sorry about the dependency. Actually it is not even required, just a copy paste mistake. ... I just liked to project the y and x as properties of the
    Message 1 of 5 , Mar 26, 2004
    • 0 Attachment
      On Wed, 24 Mar 2004 at 2:12am, Antony Scriven wrote:

      > Hari Krishna Dara wrote:
      >
      > > On Mon, 22 Mar 2004 at 7:16pm, Hari Krishna Dara wrote:
      > >
      > > > I have just uploaded a newer version multvals plugin. Please read the
      > > > [...]
      > > >
      > > I wanted to share the result of an interesting performance experiment
      > > that I did using multvals. When I needed a more complex datastuctures
      > > for my nibble game, what I wanted to know is if multvals can perform
      > > well or if I should go for a solution involving Vim built-in features
      > > (such as the curly-brace variables, so called arrays). So I have written
      > > a test function that compares lookup speeds for a multvals array and a
      > > linked list created using the built-in arrays, and the result was that
      > > multvals was faster by up to 3 times and never slower. Here is the
      > > function that I used, if you are interested. Increase teh loop iteration
      > > size to get more clearer results.
      > >
      > >
      > > function! MvCompareBuiltIn()
      > > exec MakeArgumentString()
      >
      > Ah, found the dependency. Ignore my other mail if you can.

      Sorry about the dependency. Actually it is not even required, just a
      copy paste mistake.

      >
      > > [...]
      > >
      > > while i <= 80
      > > let array = MvAddElement(array, ';', y.','.i)
      > > let array{i}{'y'} = y
      > > let array{i}{'x'} = i
      > > let array{i}{'next'} = ''
      > > let array{i-1}{'next'} = i
      > > let i = i + 1
      > > endwhile
      >
      > You can write:
      >
      > let array{i}y = y
      > let array{i}x = i

      I just liked to project the 'y' and 'x' as properties of the 'array'
      class, so that is why the usage. I tried with the above suggested usage,
      but that didn't make any noticiable difference in the timings (at least
      not in seconds :).

      >
      > etc. Actually the x value is redundant. If instead of `80'
      > you use
      >
      > let count = 80
      > while i <= count
      > ...
      >
      > then you can do your lookup like this:
      >
      > if x < count && array{x}y == y
      > let result = 1
      > endif
      >
      > instead of looping over or traversing the list. However I do
      > realise that this is just a test, and that your real world
      > requirements may not always permit this kind of thing.

      In my actual scenario, I am using this structure for representing a
      point on the screen, so both are required. I just simplified it in this
      case for the ease of writing the test case.

      >
      > I've found it convenient on occasion to combine both
      > techniques: using var_{x} to create an array and then
      > storing multiple items as a string list: 'item1,item2,...'.

      Yes, that is exactly what I did for creating the snake and blocks to
      obstruct the snake in my nibble game. The blocks are actually vim
      arrays, with different set of properties, one of which is the set of
      points. I was contemplating between represening this also as vim arrays
      and as a string, the way you suggested. After doing the performance
      test that I posted earlier, I had decided to represent it as a colon
      separated points (each of which is of the form "x,y").

      >
      > Antony
      >

      Thanks for responding,
      Hari

      __________________________________
      Do you Yahoo!?
      Yahoo! Finance Tax Center - File online. File on time.
      http://taxes.yahoo.com/filing.html
    Your message has been successfully submitted and would be delivered to recipients shortly.