News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Python & fast Instr()

Started by jj2007, January 24, 2019, 08:03:02 PM

Previous topic - Next topic

hutch--

> Hutch will be happy to see that even with 32GB of RAM, you can allocate only 1.5GB in a 32-bit process

I test with 64 gig of memory but with /LARGEADDRESSAWARE in 32 bit you should be able to allocate up to 2 gig and still have about 700 meg free. Depends on the video card.

TBRANSO1

@JJ

I'm not sure why Python is mentioned or whether why you are trying to challenge Python, but anything in assembly will be monumentally faster.  The Python method is find('substring', start, finish).  In Ruby, it is include?, but Ruby has a bajillion versions all of them are syntactic sugar for the same thing...

A while back in a Data Structures class we had to implement string search algorithms, so I made one from scratch in Java, Ruby and Python, and tested them.  The preferred algorithm to search for a substring in an array of characters is some version of rabin-karp or knuth-pratt algorithms.  I believe that all languages use some form of these, optimized for the language platform.

I attached a file done in Ruby that is based on the rabin-karp, it can search any string and find the pattern and offset, and match it.

Anywho, I will add this to my list of scripts to make in assembly, this will be fun, since it requires a good random num generator, prime generator, regex parser, and hash generator.




jj2007

Python is slow. Except when it is fast.

We must keep separate the language (often slow) and its functions, which may have been coded in excellent assembly. Python, for example, has the fastest sort functions of all hi level languages.