ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm trying to add Searching to my website, and I'm really ITCHING to write the searching stuff in asm. Is there any way to interface between PHP and asm, short of just making an EXE and redirecting between them using > and < .
To add to the problem, my hosts have 64 bit servers and I don't know 64-bit asm! (( (but that's another topic).
I think I don't really know what I'm asking, but if YOU have experience, maybe you'll get it. Just my pore confused brain at work!
When you write stuff in asm it compiles to a OS specific binary (elf,pe.. etc), you don't interface directly with "asm" as such. A PHP file is a script which is compiled at runtime by the php interpreter, you may want to read up on the difference between compiled and interpreted languages. There's a good asm intro here which should help but you'll need to download the videos.
I have been programming since '87 kbp, I know what you said. To make it clearer, what I was looking for is a way to do "inline asm", like you can do in C. Is that at all possible?
All is possible, you could compile asm on the fly by executing shell commands to compile asm code in the php page (assuming building tools are available in the server), but what would be the point
I would rather compile asm code once and use it as CGI program, but frankly for a search engine I don't know if there is any advantage to use asm
All is possible, you could compile asm on the fly by executing shell commands to compile asm code in the php page (assuming building tools are available in the server), but what would be the point
I would rather compile asm code once and use it as CGI program, but frankly for a search engine I don't know if there is any advantage to use asm
What kind of shell commands? Could you be a bit clearer?
Why ? That is, can you prove that whatever string matching library you use is slow because it is written in "C" and not in assembly ?
Or maybe you are using an algorithmically inefficient library ?
I don't even know OF any libraries, good or bad. I'm doing it because I LIKE programming. Asm is my first love, and I haven't touched it in along time (as may be evident from the fact that I don't know 64-bit ), so - just wanted to do what my heart dictates
something like this might work, or if your servers allow CGI, write the search parts as cgi scripts that provide machine parsable output and call them using curl to pass the information to them and read the output into a string, then write a snippet to parse and format the output.
as for putting the ASM code inline? php is an interpreted language and as far as i know doesn't have facilites to do such implemented.
Then read http://en.wikipedia.org/wiki/Million_Roses and look up the song on YouTube or wherever. The song is about a poor artist/painter who sold all his possessions and bought 1e6 scarlet roses to give them to the woman he loved.
heh sorry guys, I don't have any formal comp sci training about compiler theory or whatever, and writing a PHP *extension* would be outside my abilities. and of course, I'd have to study for a couple of years to find out all about PHP's innards. no, can't do.
just wanted to know if *someone's* done it.
ntubski, hugs and kisses for that info. haven't been to the page yet, but will
The first thing to try is PCRE: http://en.wikipedia.org/wiki/PCRE . And/or to "cannibalize" the library from Perl itself - it's AFAIK is faster. But both are not the fastest - I know people have written their own faster libraries in "C" - I am talking about a person who did this for work, so his library is not publicly available.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.