0

So I was searching for the save file in a dump of Blender (a 3d modelling software, but that's unrelated to my question)'s memory since it wouldn't save for some reason. Then I opened up the dump in lldb, and searched for the header that I got from a xxd dump of existing save file:

00000000: 424C 454E 4445 522D 7632 3832 5245 4E44  BLENDER-v282REND
00000010: 4800 0000 D00A 63E6 FE7F 0000 0000 0000  H.....c.........
00000020: 0100 0000 0100 0000 7800 0000 5363 656E  ........x...Scen
00000030: 6500                                     e.

Which got me thinking: would search algorithms perform better if say for example I searched for BLENDER or would it be more efficient if I searched for BLENDER-v282RENDH? I'm not just talking about lldb's search algorithm, I know there are many different ones, and I'm asking in general if more or less keywords would be easier for the computer to handle. I hope this question's fairly easy to answer, and sorry if this is just a stupid question. Thanks in advance!

sportzpikachu
  • 831
  • 5
  • 18
  • Since the search will need to match one character of the string at a time you might as well provide the full string up front. – 500 - Internal Server Error Mar 09 '20 at 08:56
  • @500-InternalServerError I want to know whether or not say 10 characters is handled better or 20 characters, but thanks for your suggestion. – sportzpikachu Mar 09 '20 at 09:00
  • I suppose it depends on the algorithm, but for example with [Boyer–Moore](https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string-search_algorithm) ([used by grep](https://stackoverflow.com/questions/12629749/how-does-grep-run-so-fast), among others), searching for longer sequences can be faster, since they allow you to skip more bytes from the input. – jdehesa Mar 09 '20 at 14:51
  • Right, but that only comes out faster when you search the same body of text multiple times. – 500 - Internal Server Error Mar 09 '20 at 15:11
  • @jdehesa, that's the type of information I'm looking for! Could you go more in depth and post it in an answer? Thanks! – sportzpikachu Mar 10 '20 at 01:18
  • @sportzpikachu To be honest, I don't think I can, I'm not really familiar with the algorithm and my previous comment more or less sums up my knowledge on the topic. Maybe someone else could give more insight, but you can also refer to the links, and if you feel confident after reading about it maybe you can write your own answer. – jdehesa Mar 10 '20 at 12:09

0 Answers0