Jump to content
Macro Express Forums

MEP FAIL vs ME3 Not FAIL


Recommended Posts

Agreed, with small sets and if both are sorted, the "simple" method is probably as fast, though once you start keeping track of start points it's only marginally simpler.

 

What you are calling a shuffle sort I call a bubble sort -- yes I have written them. I also gave up on other sort methods because the bubble sort was "good enough". Also have written binary searches in IBM Assembler and COBOL languages, but not in ME. Later COBOL compilers were nice because they added a variant of the SEARCH verb that automatically searched binarily (new word?) rather than sequentially. Working with random check numbers flying through a check sorter at 20 checks per second, the binary search was the only practical lookup method fast enough to route the checks to the right pocket.

Link to comment
Share on other sites

Bob you might want to take care as to which reply button you use. This one was threaded back to the original post. The default view doesn't appear threaded but I for one like it. I should write a post on this...

 

Luckily in the real world of programming we don't have to worry because these functions are built in.

 

I thought the bubble sort it was an in place sort where you compare element N and N+1 and if out of order swap. Do this the entire way thru and flag if there was a sort. Keep doing this hundreds of times and eventually you will get a clean pass and the array is sorted.

 

Sorry, getting off topic.

Link to comment
Share on other sites

Bob you might want to take care as to which reply button you use
I don't understand. If I want to quote part of a post, I use the Reply button with the quotation marks, then I edit out the text I don't want within the quote. If I just want to add to the thread, I click the Fast Reply button. I still haven't figured out a use for the +Quote button.

 

Edit: I just read your other post. Makes sense now. Except I still don't know what the +Quote button is for.

Link to comment
Share on other sites

Edit: I just read your other post. Makes sense now. Except I still don't know what the +Quote button is for.
I couldn't figure that one out either for awhile. How it works is you toggle the "add quote" button for multiple messages and when you reply they all appear in that message. Pretty cool actually!
Link to comment
Share on other sites

I really appreciate you looking into this and look forward to a fix. If your suspicions are true I would't mind a geek description of what the problem was. I always like opportunities to understand how things work behind the curtain.

 

I'd second that, Chris, both points. It might help explain other strange behaviour.

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

Well, I did a bit of work on this on Friday (with no success), but I managed to get it figured out this morning (the weekend break probably helped). I believe I've managed to optimize all cases where strings contain large amounts of data. At least, Steve's macro is now operating as fast as ME3 (even with the Update TextBox command enabled in the loop).

 

Now, for the geeky explanation (as requested):

The problem is in the way that ME3 and MEPro differ in variable handling. With ME3, there were a fixed number of variables, so I just allocated a fixed block of memory for each variable. Then, when I wanted a string, I already knew exactly where in memory it was, so I didn't need to copy any memory, do any lookups, etc.

 

With MEPro, there is an unlimited number of variables, each with a different name. So, when a variable is accessed, MEPro does a quick search through the variable tree, figures out what array index the user is looking for and finds the appropriate pointer in memory. However, due to the way the variables were implemented, this area in memory is rather generic. So, if you want to do a string comparison, it had to allocate a Delphi string variable and copy the memory into that location (Delphi is the programming language MEPro is written in). This is where the bottleneck is occurring (for smaller values, it doesn't make a huge difference. But, in the case of a multi-megabyte string value, it adds up very quickly).

 

Now, with the change I just made, string variables are allocated in a separate region of memory as Delphi strings (this is what makes the whole thing faster). When a string variable is requested, MEPro now figures out what string it needs and simply does the comparison without the need to allocate and copy memory since everything is already in a Delphi string variable. Without the need to reallocate and free memory through a repeat loop, everything simply responds better.

 

I hope that my explanation helps. In short, though, when the next build is released, macros that deal with huge strings, such as Steve's, should run significantly faster.

Link to comment
Share on other sites

Thanks a bunch Chris, especially for the explanation. I know most don't care but I find that understanding a few things like this helps me choose a more efficient solution to my problems. I'm really looking forward to taking this for a test drive!

Link to comment
Share on other sites

Thanks a bunch Chris, especially for the explanation. I know most don't care but I find that understanding a few things like this helps me choose a more efficient solution to my problems. I'm really looking forward to taking this for a test drive!

 

... and I'll second that too, thanks!

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...