Posts: 68
Threads: 8
Joined: Nov 2022
Reputation:
11
To me, adding memmem() to QB64PE is a must-have, wanna see our QuickBasic64PE standing tall when the word 'Quick' is mentioned.
Here comes Railgun_Nyotengu...
Five reasons to boost our beloved QB64PE:
- License is 100% FREE, the GLIBC and musl are with LGPL 2.1+ w/exceptions and MIT respectively;
- Written by an actual QB64PE aficionado;
- Make the 'Q' great again;
- Trashes to smithereens the hyped Two-Way and BMH implementations;
- Being FASTEST in practice.
Just uploaded to GitHub the Railgun memmem() which is an excellent choice to fill this gap (especially for Windows users who lack that function).
https://github.com/Sanmayce/Railgun
How nifty would it be to dare the coders using other languages about "how fast is your search function", hee-hee.
"He learns not to learn and reverts to what the masses pass by."
Posts: 486
Threads: 24
Joined: Nov 2022
Reputation:
51
Over my head, but love the passion!
@a740g @offbyone @rhosigma @smcneill are needed here.
Posts: 854
Threads: 120
Joined: Apr 2022
Reputation:
21
(03-06-2025, 08:13 PM)grymmjack Wrote: Over my head, but love the passion!
@a740g @offbyone @rhosigma @smcneill are needed here.  Yeah, can we get a laymen's description of this, for us mere mortals?
Posts: 331
Threads: 52
Joined: May 2022
Reputation:
43
(03-07-2025, 03:22 PM)madscijr Wrote: (03-06-2025, 08:13 PM)grymmjack Wrote: Over my head, but love the passion!
@a740g @offbyone @rhosigma @smcneill are needed here.  Yeah, can we get a laymen's description of this, for us mere mortals? 
If that's what I'm thinking, it should search for a larger block of bytes inside the memory block. Something like Instr or _Intsrrev but not for a string, but in the _MEM array. I would solve it by loading the block as a string and then using Instr or _Instrrev, but I don't really know if these functions can return a value of type _Integer64.
But it's also possible that it's something completely different.
Posts: 2,903
Threads: 342
Joined: Apr 2022
Reputation:
255
(03-07-2025, 03:22 PM)madscijr Wrote: (03-06-2025, 08:13 PM)grymmjack Wrote: Over my head, but love the passion!
@a740g @offbyone @rhosigma @smcneill are needed here.  Yeah, can we get a laymen's description of this, for us mere mortals? 
memmem is a command similar to strstr -- its purpose is to look for a str (string) inside a str (string). (Thus the name strstr.) memmem is basically supposed to look for a mem block inside a mem block.
The QB64PE version of these commands would basically be INSTR and _INSTRREV.
All the above is basically just a spam-type plug saying, "WE HAS THE BETTER STUFFS!!", all without ever actually sharing any code, libraries, or compilable examples where a person can test for themselves to see if the "better stuffs" is actually better or not.
https://github.com/Sanmayce/Railgun <-- Even if you follow this link to the github, all you'll find there is one whole file for the entire github... README.md.
Yeppers!! Just a readme text file, with the *exact* same contents as what was posted above. Once again, there is no code, libraries, or anything compilable or studyable at the site.
So TLDR; --> Basically just consider all the bluster above to be a spam bot at work and ignore it. There's really nothing of substance to see here.
Posts: 854
Threads: 120
Joined: Apr 2022
Reputation:
21
(03-07-2025, 05:03 PM)Petr Wrote: If that's what I'm thinking, it should search for a larger block of bytes inside the memory block. Something like Instr or _Intsrrev but not for a string, but in the _MEM array. I would solve it by loading the block as a string and then using Instr or _Instrrev, but I don't really know if these functions can return a value of type _Integer64.
That makes sense. Sounds like we already have the functionality, just need to know if it works with _Integer64? And if not, would it be hard to just modify the Instr and _Instrrev to support it?
Posts: 147
Threads: 12
Joined: Apr 2022
Reputation:
57
(03-07-2025, 05:03 PM)SMcNeill Wrote: (03-07-2025, 03:22 PM)madscijr Wrote: (03-06-2025, 08:13 PM)grymmjack Wrote: Over my head, but love the passion!
@a740g @offbyone @rhosigma @smcneill are needed here.  Yeah, can we get a laymen's description of this, for us mere mortals? 
memmem is a command similar to strstr -- its purpose is to look for a str (string) inside a str (string). (Thus the name strstr.) memmem is basically supposed to look for a mem block inside a mem block.
The QB64PE version of these commands would basically be INSTR and _INSTRREV.
All the above is basically just a spam-type plug saying, "WE HAS THE BETTER STUFFS!!", all without ever actually sharing any code, libraries, or compilable examples where a person can test for themselves to see if the "better stuffs" is actually better or not.
https://github.com/Sanmayce/Railgun <-- Even if you follow this link to the github, all you'll find there is one whole file for the entire github... README.md.
Yeppers!! Just a readme text file, with the *exact* same contents as what was posted above. Once again, there is no code, libraries, or anything compilable or studyable at the site.
So TLDR; --> Basically just consider all the bluster above to be a spam bot at work and ignore it. There's really nothing of substance to see here.
Hey Steve, is there a way to turn off that damn tagging when someone just quoted the tag, tired of getting tagged everytime, just to see when following it, that just another one quoted an article I've already read a dozen times.
Posts: 2,903
Threads: 342
Joined: Apr 2022
Reputation:
255
Not that I know of. I wish there was an option for that. "Ignore Tags on Replies" would be *lovely*!
Posts: 331
Threads: 52
Joined: May 2022
Reputation:
43
I don't know for what it will, but it's such trivial stupidity... If you want it faster, you have to choose an even better method - for example, filtering. But I won't deal with that. Here is a basic version, of course, if you are going to search gigabyte and larger arrays, you must waiting to output with this version.
Because I don't have enough knowledge to apply the Boyer-Moore or Boyer-Moore-Horspool algorithm, or deal with parallelization to increase speed right now. Practically speaking, if you are going to search Gigabyte and larger arrays, divide them into smaller ones but don't forget about the overlap (if it happens that half of the sample you are looking for will lie at the end of the smaller block and the other half at the beginning of the next block during the next reading) - without the overlap you would never find the sample. But in general - if you really need lightning-fast output in your program, this is a stupid solution. Just save the offset when storing to memory or choose small memory blocks - they will be searched faster.
Code: (Select All)
Dim m As _MEM
Dim As _Offset p
Dim As _Unsigned _Integer64 c, Offset, BinPos
m = _MemNew(100000000) '100 Mbyte block
Do Until p = m.SIZE - 8 'fill memory with some random data
c = 18446744073709551615 * Rnd
_MemPut m, m.OFFSET + p, c
p = p + 8
Loop
Binaries$ = "World!"
BinPos = (m.SIZE - Len(Binaries$)) * Rnd 'get random offset
Print "Random Offset: "; BinPos
_MemPut m, m.OFFSET + BinPos, Binaries$ 'place data to ram
Print "Searching string: "; Binaries$
Offset = SearchOffset(m, Binaries$)
Dim Test As String
Test = Space$(Len(Binaries$))
Print "Function return Offset: "; Offset
_MemGet m, m.OFFSET + Offset, Test$
Print "Output: (function) "; Test$
Print "Random offset in begin: "; BinPos
_MemGet m, m.OFFSET + BinPos, Test$
Print "Output: (random in begin) "; Test$
Function SearchOffset~&& (N As _MEM, b As String)
Dim srch As String
Dim Result As _Offset
Dim J As Long
srch = Space$(Len(b))
fca = Asc(b, 1)
Do Until J >= N.SIZE - Len(b)
Do Until _MemGet(N, N.OFFSET + J, _Unsigned _Byte) = fca
J = J + 1
Loop
_MemGet N, N.OFFSET + J, srch$
Result = InStr(1, srch$, b)
If Result Then SearchOffset = J + Result - 1: Exit Function
J = J + 1
Loop
End Function
Posts: 68
Threads: 8
Joined: Nov 2022
Reputation:
11
(03-07-2025, 05:03 PM)SMcNeill Wrote: (03-07-2025, 03:22 PM)madscijr Wrote: (03-06-2025, 08:13 PM)grymmjack Wrote: Over my head, but love the passion!
@a740g @offbyone @rhosigma @smcneill are needed here.  Yeah, can we get a laymen's description of this, for us mere mortals? 
memmem is a command similar to strstr -- its purpose is to look for a str (string) inside a str (string). (Thus the name strstr.) memmem is basically supposed to look for a mem block inside a mem block.
The QB64PE version of these commands would basically be INSTR and _INSTRREV.
All the above is basically just a spam-type plug saying, "WE HAS THE BETTER STUFFS!!", all without ever actually sharing any code, libraries, or compilable examples where a person can test for themselves to see if the "better stuffs" is actually better or not.
https://github.com/Sanmayce/Railgun <-- Even if you follow this link to the github, all you'll find there is one whole file for the entire github... README.md.
Yeppers!! Just a readme text file, with the *exact* same contents as what was posted above. Once again, there is no code, libraries, or anything compilable or studyable at the site.
So TLDR; --> Basically just consider all the bluster above to be a spam bot at work and ignore it. There's really nothing of substance to see here. The sourcecode is at releases section:
https://github.com/Sanmayce/Railgun/releases
And the benchmark is fully reproducible!
> Yeppers!! Just a readme text file, with the *exact* same contents as what was posted above. Once again, there is no code, libraries, or anything compilable or studyable at the site.
Lies, lies, and since when a single function needs a library
I cannot believe how hateful and stupid things you said, a super moderator - you are not.
"He learns not to learn and reverts to what the masses pass by."
|