Pandemikk Posted September 12, 2011 Share Posted September 12, 2011 Sorry, I missed your edit. When I replied you said you couldn't find it on php.net. Basically, it's exponents. For example, pow(2, 2); return 4. pow(4, 4); would return 16. I'd assume pow is just short for "power". So think of it as, 2 to the power of 2; or 4 to the power of 4. And yes, that one is extremely slow. Didn't test it out until now. Quote Link to comment https://forums.phpfreaks.com/topic/246835-i-need-this-code-to-execute-faster/page/2/#findComment-1268181 Share on other sites More sharing options...
tastro Posted September 12, 2011 Author Share Posted September 12, 2011 lol i get it now... 2*2*2*2*2*2*2*2*2 omg... easy math. just didn't know what it does... all clear now. one more question... xyph what does your code make so fast? the binary input instead of the decimal or is it just the code structure? Quote Link to comment https://forums.phpfreaks.com/topic/246835-i-need-this-code-to-execute-faster/page/2/#findComment-1268183 Share on other sites More sharing options...
xyph Posted September 12, 2011 Share Posted September 12, 2011 It loops through the results as few times as possible. It doesn't have to perform any array searching (which is pretty much more loops) The binary helps me figure out what goes where, it's just a method of doing that The structure is the speed Quote Link to comment https://forums.phpfreaks.com/topic/246835-i-need-this-code-to-execute-faster/page/2/#findComment-1268194 Share on other sites More sharing options...
tastro Posted September 12, 2011 Author Share Posted September 12, 2011 thank you! it's really awesome. it there a way to do it the same way, but decimal instead of binary? just asking... because it would be easier for me to understand... but if it's not possible then i will learn to understand the binary way. i know how to convert decimal to binary and vice versa some nice images here for the ones who doesn't know it yet, but i think that almost all learned it in the high school. http://pad2.whstatic.com/images/4/47/B2d.gif and http://www.wikihow.com/images/5/5a/D2b.gif Quote Link to comment https://forums.phpfreaks.com/topic/246835-i-need-this-code-to-execute-faster/page/2/#findComment-1268252 Share on other sites More sharing options...
tastro Posted September 12, 2011 Author Share Posted September 12, 2011 someone asked before, for what do i need this? i'm making a search, so that when people enter words into an input (search query)... then if i have all the word combinations of all my posts (titles) then i can just read from my database all posts which match this words. also if someone has an better idea, then please let me know. Quote Link to comment https://forums.phpfreaks.com/topic/246835-i-need-this-code-to-execute-faster/page/2/#findComment-1268331 Share on other sites More sharing options...
xyph Posted September 12, 2011 Share Posted September 12, 2011 That isn't a good way to search. http://devzone.zend.com/article/1304 Quote Link to comment https://forums.phpfreaks.com/topic/246835-i-need-this-code-to-execute-faster/page/2/#findComment-1268412 Share on other sites More sharing options...
tastro Posted September 13, 2011 Author Share Posted September 13, 2011 this could be a problem. i don't use mysql as my database. :S i write it all to files. Quote Link to comment https://forums.phpfreaks.com/topic/246835-i-need-this-code-to-execute-faster/page/2/#findComment-1268917 Share on other sites More sharing options...
xyph Posted September 13, 2011 Share Posted September 13, 2011 Well, I hope this is just a proof of concept, because a complex multi-string search through a flat file of any significant size will be slow. Wouldn't take many concurrent requests to bog the server. Quote Link to comment https://forums.phpfreaks.com/topic/246835-i-need-this-code-to-execute-faster/page/2/#findComment-1268919 Share on other sites More sharing options...
tastro Posted September 13, 2011 Author Share Posted September 13, 2011 i know... that's why i made more flat txt files, so that they are smaller and they load faster. Quote Link to comment https://forums.phpfreaks.com/topic/246835-i-need-this-code-to-execute-faster/page/2/#findComment-1268992 Share on other sites More sharing options...
tastro Posted September 15, 2011 Author Share Posted September 15, 2011 topic solved. thanks to all! Quote Link to comment https://forums.phpfreaks.com/topic/246835-i-need-this-code-to-execute-faster/page/2/#findComment-1269560 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.