Ask Question Forum:
Model Library:2025-02-08:A.I. model is online auto reply
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by duncanb7
at 2024-11-05 10:20:10
Point:500 Replies:13 POST_ID:828779USER_ID:11059
Topic:
C Programming Language;;C++ Programming Language
I have done my created huge math function such as order 20 of polynomial/regression function with 10,000 data input in PHP program.
After math calculation is done , I will echo out the output
to the client browser. Since the function is huge almost
costing it 15 seconds to finish, I want to replace the math
function by other languages.
Recently, I heard javascript on server-side, Node.js, so
I know javascript is much easy to use as PHP coding , and I check
its speed is much faster than PHP as C
So now I try to make desicion on switch programming Lanauge on Javascript
or C or C++
But C or C++ is really time consuming to get to know everything such as
its complicated pointer structure or its sytnax
How do you think about using Javascript to do huge math function instead of
using C or C++ ?
And what is major different between C and C++ in doing huge math function ?
Or other lanaguage could handle huge math function code with good code and speed, please point it out ?
Please advise
Duncan
After math calculation is done , I will echo out the output
to the client browser. Since the function is huge almost
costing it 15 seconds to finish, I want to replace the math
function by other languages.
Recently, I heard javascript on server-side, Node.js, so
I know javascript is much easy to use as PHP coding , and I check
its speed is much faster than PHP as C
So now I try to make desicion on switch programming Lanauge on Javascript
or C or C++
But C or C++ is really time consuming to get to know everything such as
its complicated pointer structure or its sytnax
How do you think about using Javascript to do huge math function instead of
using C or C++ ?
And what is major different between C and C++ in doing huge math function ?
Or other lanaguage could handle huge math function code with good code and speed, please point it out ?
Please advise
Duncan
Author: duncanb7 replied at 2024-11-11 02:48:11
Thanks for all of reply , your attached link is helpful a lot to the issue.
Expert: julianH replied at 2024-11-07 07:03:18
I have no personal experience with HipHop.
Author: duncanb7 replied at 2024-11-07 05:44:58
Dear Ambience and JulianH
Could you reply my last post and read this new thread
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_28287892.html
Please advise
Duncan
Could you reply my last post and read this new thread
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_28287892.html
Please advise
Duncan
Author: duncanb7 replied at 2024-11-06 10:11:34
Is HipHOP similar to Zend framework or Zend php or Zend server
http://en.wikipedia.org/wiki/Zend_Framework
that also is process to get better php code optimization from converting some part php
code in php file into C/C+= coding ?
I run command "zf show version " that is checking version of zend framework and it showed
zend is not installed.
How I can know whether my server is already installed HIPHOP or not ?
Please advise
Duncan
http://en.wikipedia.org/wiki/Zend_Framework
that also is process to get better php code optimization from converting some part php
code in php file into C/C+= coding ?
I run command "zf show version " that is checking version of zend framework and it showed
zend is not installed.
How I can know whether my server is already installed HIPHOP or not ?
Please advise
Duncan
Accepted Solution
Expert: ambience replied at 2024-11-06 03:55:11
300 points GOOD
Perhaps you should also consider a PHP cross compiler like HipHop (http://en.wikipedia.org/wiki/HipHop_for_PHP) that converts PHP code into C/C++. Facebook created that to solve their performance issues. It may not be as efficient as hand-coded C/C++ stuff but still worth looking.
There are several cross-compilers actually.
There are several cross-compilers actually.
Expert: julianH replied at 2024-11-05 21:57:38
you mean I don't have any benefit to run C using exec() in php, RIght
No - definitely not. If you can write the app in C then it is the best solution for performance.
What I meant was - if you are going to write your math intensive code in C and then launch that from a server side scripting environment - then the scripting language you use is irrelevant because it is not really doing anything. The performance is going to be dictacted by the speed of the C app.
In other words PHP launches C app vs Java launches C app vs .Net launches C App is much of a muchness.
Author: duncanb7 replied at 2024-11-05 20:36:17
So what you mean, please advise
Even max_execution_time or set_timeout is no issue at al,
you mean I don't have any benefit to run C using exec() in php, RIght ? WHy ?
Or
I need to rewrite all PHP code into C instead rather than just some math cals code
that might speed it up by not using PHP environment or PHP slow engine, RIght ?
Please advise it in detail
DUncan
Given you are going to be exec'ing the prog that does the intensive math calcs - the host environment (PHP / Java) is irrelevant and should give you no performance benefit either way.
Even max_execution_time or set_timeout is no issue at al,
you mean I don't have any benefit to run C using exec() in php, RIght ? WHy ?
Or
I need to rewrite all PHP code into C instead rather than just some math cals code
that might speed it up by not using PHP environment or PHP slow engine, RIght ?
Please advise it in detail
DUncan
Expert: julianH replied at 2024-11-05 12:47:27
I meant if you wanted to interact directly with the C program.
Given you are going to be exec'ing the prog that does the intensive math calcs - the host environment (PHP / Java) is irrelevant and should give you no performance benefit either way.
If you are going to use PHP you should have a look at the set_timelimit function (http://php.net/manual/en/function.set-time-limit.php) to ensure your script does not timeout before the math app completes.
Given you are going to be exec'ing the prog that does the intensive math calcs - the host environment (PHP / Java) is irrelevant and should give you no performance benefit either way.
If you are going to use PHP you should have a look at the set_timelimit function (http://php.net/manual/en/function.set-time-limit.php) to ensure your script does not timeout before the math app completes.
Author: duncanb7 replied at 2024-11-05 11:09:07
It will be faster but if you are interacting with a browser you are going to have to write it so that it can interact with the web server (using CGI or as an extension).
What you mean CGI ? php is CGI script langauge already , right ?
Author: duncanb7 replied at 2024-11-05 11:07:21
I am planning write a C running in PHP with exec() command
for example,
<?php
php code
....
....
test=exec("../../C/mymath order data test.csv");
file_get_content("test.csv") //which is done by C language and save the result into a file
php code for web handling
?>
for example,
<?php
php code
....
....
test=exec("../../C/mymath order data test.csv");
file_get_content("test.csv") //which is done by C language and save the result into a file
php code for web handling
?>
Assisted Solution
Expert: julianH replied at 2024-11-05 11:02:36
100 points GOOD
C and C++ are essentially identical when it comes to mathematical processing - C++ is an extension to the C language to provide object orientation and other extensions.
It will be faster but if you are interacting with a browser you are going to have to write it so that it can interact with the web server (using CGI or as an extension).
As far as I know node.js is a framework for writing server side code - it may be useful for your purposes but javascript is the language there - node.js is just the framework.
One option is to write the heavy stuff in C - have the script kick that off - which writes to a file. When complete the script reads the file and returns the results to the browser.
It will be faster but if you are interacting with a browser you are going to have to write it so that it can interact with the web server (using CGI or as an extension).
As far as I know node.js is a framework for writing server side code - it may be useful for your purposes but javascript is the language there - node.js is just the framework.
One option is to write the heavy stuff in C - have the script kick that off - which writes to a file. When complete the script reads the file and returns the results to the browser.
Author: duncanb7 replied at 2024-11-05 10:56:57
Yes, I check the speed in Node.js and C that is similar doing
1e10 times of addition/subtraction math,
And yes javascript is interpreted language not complied language
but Node.js is running much faster than PHP that is also interpreted language.
Also it can be running as background process with http request which is
the task will fire on request once it is running on system set up in advance
And Node.js emphasis on concurrent process that is much faster than
other language.
Anyway, I prefer to take back C or C++ because I don't want to take a risk
to try new
Shoud I use C or C++ ? which is better just for huge math function ?
executed or Complied code should run faster than interpreted code
1e10 times of addition/subtraction math,
And yes javascript is interpreted language not complied language
but Node.js is running much faster than PHP that is also interpreted language.
Also it can be running as background process with http request which is
the task will fire on request once it is running on system set up in advance
And Node.js emphasis on concurrent process that is much faster than
other language.
Anyway, I prefer to take back C or C++ because I don't want to take a risk
to try new
Shoud I use C or C++ ? which is better just for huge math function ?
executed or Complied code should run faster than interpreted code
Assisted Solution
Expert: kaufmed replied at 2024-11-05 10:45:07
100 points GOOD
You're talking about two different programming paradigms. Javascript is a scripting language that is intended to be run by a host; C and C++ are compiled languages which can be built into standalone executables. By default, C and C++ will run faster than Javascript since they are compiled directly into machine code (i.e. code that runs on the processor). For complicated match functions, I would expect that C and C++ will offer better performance, unless of course you can find a Javascript compiler. (Perhaps one exists, but I haven't heard of it. Perhaps someone else can speak to its existence.)