The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 22, 2019, 05:44:39 PM

Login with username, password and session length


Pages: [1] 2
  Print  
Author Topic: PHP to C/C++/C#/?  (Read 5754 times)
kurdt
Lifer
*****
Offline Offline

Posts: 1153


paha arkkitehti


View Profile
« on: May 24, 2009, 12:56:58 AM »

I just saw some blog post about PHP to C++ converter and now I can't find it anymore.

Has anybody tested this? Because it would sure rock if it would speed up DB handling for example. I think I read from the blog post that it doesn't work with curl but maybe perkiset's webrequest?

Sad thing is that I wanted to start learning Python but I just don't have the time it seems and I have also wanted to learn C because vsloathe seems to love it so much and I know it's way way faster than PHP.
Logged

I met god and he had nothing to say to me.
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #1 on: May 24, 2009, 10:55:58 AM »

I only love C when it's the best tool for the job.

Otherwise, she's a cruel mistress.

Have you ever dealt with pointers before?
Logged

hai
kurdt
Lifer
*****
Offline Offline

Posts: 1153


paha arkkitehti


View Profile
« Reply #2 on: May 24, 2009, 11:54:27 AM »

Have you ever dealt with pointers before?
Lifetime ago Smiley

It would be great to have a program that takes PHP code and outputs exe file that runs as fast as same program done with C Smiley
Logged

I met god and he had nothing to say to me.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #3 on: May 24, 2009, 12:10:58 PM »

Although not nearly as fast in the final run, if you use something like APC then you'll get about 10x the speed increase out of your PHP, because the pcode is already compiled. Bear in mind that when the pcode is ready, it's damn fast because it's all pointers to C code. It's certainly not optimized for C, and I'd not do things like an animation renderer in it, but the difference is stark, and I get even better than 10X benefit from it, because of the way I code.

(Caveat: APC will not help if you run everything from the shell - the APC umbrella only helps if you activate code via Apache)
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
isthisthingon
Global Moderator
Lifer
*****
Offline Offline

Posts: 2879



View Profile
« Reply #4 on: May 24, 2009, 01:09:07 PM »

Quote
Have you ever dealt with pointers before?

 ROFLMAO

Commentary:  Nerd

It may be a cruel mistress but the experience of dealing with pointers is essential to evaluate the merits of higher level languages like C++, C#, Java, etc.  Memory management, although not technically required these days due to garbage collection in frameworks such as .NET and the Java virtual machine, is fundamental to understanding how things should work, not simply how they do.  It reminds me of how Microsoft created a generation of high-level-only coders by implying that inheritance and reuse was overvalued and using a COM-based component/interface approach along with VB (5-6) was all the world really needed to know.  People from MarchFirst (a large and highly respected consulting firm that's dead now) once claimed that if you can't do it in VB (5-6), something's wrong with your design.  Perk might remember that moment since we were both on the project together.  After they [Microsoft] realized the error of their ways and bought the chief architect of Delphi and original author of Turbo Pascal, Anders Hejlsberg, they "created" .NET - once again a truly object-oriented framework.  The young coders who started in VB 5 were hardly prepared for the complexity they needed to master in order to retain their jobs. 

Clip the nails from the lions and throw them steaks Devilish
Logged

I would love to change the world, but they won't give me the source code.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #5 on: May 24, 2009, 01:24:13 PM »

Remember? I do my best to forget that one. I believe I was the one that threw you into that rat's nest as well...

Well said and spot on IMO. It seems part of M$' plan to dumb down coders so that they are reliant on M$' frameworks/APIs/Tools et al - makes great sense from a business perspective, crap from anyone that enjoys having their own brain.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
nop_90
Global Moderator
Lifer
*****
Offline Offline

Posts: 2203


View Profile
« Reply #6 on: May 24, 2009, 07:34:09 PM »

Probably it is a good plan for anyone who is serious about programming to learn how to program a simple micro-controller in assembler.
The 68HCXXX microcontrollor by motorola are really nice
They really old ones have only like 4 registers and a really nice simple instruction set.

The intel 8086 with its segmented memory is a fuking whore. Who ever thought up that one was smoking crack Cheesy
If u can program the intel family in assember anything else is a snap.

For python there are lots of solutions to increase speed.
numpy module for example maps matrix to a C structure and so if u do operations on them it is almost as fast as C
You can also access the same C structure from C, so if u have an intense computation u can rewrite it in C.

Basically now days you write ur code in some sort of higher level language.
Then profile it.
Parts which are slow u attempt to rewrite as a module written in C.

Python also has Cython.
Cython is cool. It basically has a python syntax, u then compile it to C. Then u compile that to a C module (dll).
You can also access all C structures/pointers from python.
(Also is great for using when u have to interface with C libraries).

There is also psyco another module. Basically it is a JIT compiler.
You run your python code thru it. Then it checks which parts are doing intensive number crunching. It then rewrites those parts as assembler.

delphi/.net/what ever are not true OO languages Cheesy
the only true OO language is smalltalk lol

PHP is great for web apps.
For console stuff / actual applications python/perl or ruby are much better.
Again right tool for the job.

Shit find some esotric language like erlang,scheme,lisp,ocaml
Learn how to do the basics in it. (even if u do nothing productive with it).
Keeps ur brain sharp.
Also the methods which u use to do solutions in those languages can be applied to ur other work.



Logged
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #7 on: May 24, 2009, 09:45:11 PM »

im sad I never learned/covered erlang.

its so fun to say.

"dood, like im a fucking erlang progammer, what are you? something boring like peeatchepee or silly like Lithsp?"
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #8 on: May 24, 2009, 09:52:06 PM »

The 68HCXXX microcontrollor by motorola are really nice

Werd.

Used to program 68HC11s
Logged

hai
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #9 on: May 24, 2009, 11:07:53 PM »

My first assembly was 6502, and I still see license places with "TXA" and "ROR" and the mnemonic comes to mind before I can even think.

Motorola did some great stuff, too bad they lost their mojo.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #10 on: May 26, 2009, 01:22:16 PM »

Yeah, every time I see XOR, NAND, etc. I remember all those PCBs that I put together with logic gates for simple robotics assemblies.
Logged

hai
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #11 on: May 26, 2009, 01:29:09 PM »

EE classes were fun until they started talking about physics. then I left.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
kurdt
Lifer
*****
Offline Offline

Posts: 1153


paha arkkitehti


View Profile
« Reply #12 on: June 15, 2009, 12:17:29 AM »

If anybody is still interested, you should check Roadsend compiler. It looks pretty cool but I haven't had time to test run anything more than basic Hello World.

Logged

I met god and he had nothing to say to me.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #13 on: June 15, 2009, 06:59:56 AM »

Interesting, didn't know that existed. Have to give it once-over. Thanks K.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #14 on: June 15, 2009, 08:35:10 AM »

That's the compiler that I've used before Perks.

It's the reason I rewrote your webRequest dealy in PHP4, Roadsend didn't support PHP5 when I used it, too lazy to go look at whether or not it does now.
Logged

hai
Pages: [1] 2
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!