| | |
ctypes and speed
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jul 2008
Posts: 49
Reputation:
Solved Threads: 0
I'm making a module to simulate a neural network, speed is an issue so I've written it in c, basically you build the network in python, and then run call a simulate method that is pure c.
One thing I want to add is the ability to inject current into the network as it runs, for this I thought I would have the user define a method that takes no arguments and returns a double and the network could use this as a callback function, but then I figured this would slow down the network by calling a method written in python, then I remembered ctypes.
So I wanted to ask, is PyObject_CallObject(my_callback, NULL) any slower then calling a c function if my_callback is written in c?
One thing I want to add is the ability to inject current into the network as it runs, for this I thought I would have the user define a method that takes no arguments and returns a double and the network could use this as a callback function, but then I figured this would slow down the network by calling a method written in python, then I remembered ctypes.
So I wanted to ask, is PyObject_CallObject(my_callback, NULL) any slower then calling a c function if my_callback is written in c?
•
•
Join Date: Jul 2008
Posts: 49
Reputation:
Solved Threads: 0
"Do you know what the over head is?"
I think I'll rephrase that. I'm fairly new to learning about the mechanisms of what makes python work so maybe this is a stupid question, but if a PyObject is basically a ctypes wrapper for a c function is the python interpreter ever used when I call PyObject_CallObject on it?
I think I'll rephrase that. I'm fairly new to learning about the mechanisms of what makes python work so maybe this is a stupid question, but if a PyObject is basically a ctypes wrapper for a c function is the python interpreter ever used when I call PyObject_CallObject on it?
![]() |
Similar Threads
- theoretical speed of 802.11G wireless USB adapter (Networking Hardware Configuration)
- Speed Up Those Searches Now! (Windows tips 'n' tweaks)
- cd burner speed (Storage)
- lite on 52327s speed problem, DMA issue? (Storage)
- W2K speed tweak. (Windows NT / 2000 / XP)
- NetZero..."high speed"? (IT Professionals' Lounge)
- T720 And Express Network Speed (Geeks' Lounge)
- Slow speed (Windows 95 / 98 / Me)
Other Threads in the Python Forum
- Previous Thread: Comparing two text files
- Next Thread: new-line character seen in unquoted field - do you need to open the file in universal
| Thread Tools | Search this Thread |
Tag cloud for Python
accessdenied apache application argv beginner book change code color dictionary dynamic edit editing enter examples excel file filename float format ftp function gui homework import inches input java keyboard lapse library line lines linux list lists loop microphone mouse movingimageswithpygame mysql newb number numbers numeric output parameters parsing path port prime program programming projects py2exe pygame pyopengl pyqt python random recursion recursive redirect remote reverse rpg scrolledtext search server session simple smtp software sprite ssh statictext string strings syntax table tennis terminal text thread threading time tkinter tlapse trick tuple tutorial ubuntu unicode unit urllib urllib2 variable windows wordgame wxpython






