Sponsored Content
Top Forums Programming Python program faster than C++ program. Post 302465739 by cbreiny on Sunday 24th of October 2010 02:07:51 AM
Old 10-24-2010
Python program faster than C++ program.

I wrote a simple program that generates a random word 10,000,000 times.
I wrote it in python, then in C++ and compared the two completion times. The python script was faster! Is that normal? Why would the python script be faster? I was under the impression that C++ was [generally] faster. What are some of your thoughts?
 

10 More Discussions You Might Find Interesting

1. Programming

How to write to stdin of another program (program A -> [stdin]program B)

Hi, Program A: uses pipe() I am able to read the stdout of PROGAM B (stdout got through system() command) into PROGRAM A using: * child -> dup2(fd, STDOUT_FILENO); -> execl("/path/PROGRAM B", "PROGRAM B", NULL); * parent -> char line; -> read(fd, line, 100); Question: ---------... (1 Reply)
Discussion started by: vvaidyan
1 Replies

2. Programming

A program to trace execution of another program

Hi, I wanted to know if i can write a program using switches and signals, etc to trace execution of other unix program which calls c program internally. If yes how? If not with signals and switches then are there any other methods apart from debugging with gdb/dbx. (3 Replies)
Discussion started by: jiten_hegde
3 Replies

3. UNIX for Dummies Questions & Answers

Script to open program and send/execute command in program

Hi, i want to write a script that executes a program (exec?) . this program then requires a filename as input. how do i give it this input in the script so the program will be complete run and close by the script. e.g. exec prog.exe program then asks for filename "enter filename:"... (1 Reply)
Discussion started by: tuathan
1 Replies

4. Shell Programming and Scripting

Shell script to run a python program on multiple entries in a file

Hello I am trying to run a python program using shell script, which takes a single argument from a file. This file has one entry per line : 1aaa 2bbb 3ccc 4ddd 5eee ... ... ... My shell script runs the program, only for the last entry : #!/bin/sh IFS=$'\n' for line in $(cat... (2 Replies)
Discussion started by: ad23
2 Replies

5. Homework & Coursework Questions

Calling compiled C program with Perl program

Long story short: I'm working inside of a Unix SSH under a bash shell. I have to code a C program that generates a random number. Then I have to call the compiled C program with a Perl program to run the C program 20 times and put all the generated random #s into a text file, then print that text... (1 Reply)
Discussion started by: jdkirby
1 Replies

6. AIX

Strange problem running python program from within ant

Hello, I'm currently trying to port an ant based build to AIX 6.1. The build queries the underlying version control system (Mercurial) for some data, which works fine on other platforms (Linux, Solaris). However, on AIX the hg command fails to load python's md5 module when used in the build,... (1 Reply)
Discussion started by: dhs
1 Replies

7. Programming

Regarding Python Program with Shell Script

Hi All, I have written a shell script which is using the expect method, it is working fine in terminal window, and then I have executed via python script its also working fine in command prompt functioning properly, I used subprocess.Popen method to execute the shell script file, its working... (0 Replies)
Discussion started by: janaefx
0 Replies

8. Programming

Python program

Can someone help me please to write a Python program that support a processing of arithmetic expressions in postfix notation. Expressions in postfix notation contain the operands on which the operation is performed followed by an operator. For example, 3 4 + is equal to 3 + 4 in the infix... (2 Replies)
Discussion started by: Jim-266
2 Replies

9. Shell Programming and Scripting

Tweak python program to give result in json

Hi , Below is the script which prints result in json but when i validate it has some tab or extra space issues. JSON result { "data": } This is the line I tweaked. Please advise. print "\t{", "\"{#NAME}\":\""+container+hn+"\"}" #!/usr/bin/env python # (2 Replies)
Discussion started by: ashokvpp
2 Replies

10. Shell Programming and Scripting

Perl program get a response before the program quits

I created a program, so a kid can practice there math on it. It dispenses varies math problems and the kid must input an answer. I also want it to grade the work they have done, but I can't find the best place for it to print out the grade. I have: if ( $response =~ m/^/ ) { $user_wants_to_quit... (1 Reply)
Discussion started by: germany1517
1 Replies
IRUNNER(1)																IRUNNER(1)

NAME
irunner - interactive runner interface SYNOPSIS
irunner [options] file_to_run DESCRIPTION
irunner is an interface to the various interactive runners available in IPython's irunner module. It can used to run scripts as if they where typed up interactively. The already implemented runners are listed below; adding one for a new program is a trivial task, see the source for examples. OPTIONS
-h, --help show this help message and exit --ipython IPython interactive runner (default). --python Python interactive runner. --sage SAGE interactive runner. EXAMPLE
irunner.py --python -- --help will pass --help to the python runner. Similarly, irunner.py --ipython -- --interact script.ipy SEE ALSO
ipython(1) AUTHOR
irunner is an extension of Ken Schutte <kschutte-AT-csail.mit.edu>'s script contributed on the ipython-user list: http://mail.scipy.org/pipermail/ipython-user/2006-May/003539.html This manual page was written by Bernd Zeimetz <bernd@bzed.de>, for the Debian project (but may be used by others). Modified by Fernando Perez <Fernando.Perez@berkeley.edu> for inclusion in IPython. July 15, 2011 IRUNNER(1)
All times are GMT -4. The time now is 09:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy