是否有可能加强cgi的导入? [英] Is it possible to fasten the import of cgi?

查看:65
本文介绍了是否有可能加强cgi的导入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个cgi-script dat使用模块cgi,os,sys和time。幕后我

无法计算用于导入时间的时间,但os和sys不需要花费更多的时间来计算毫秒数。我的脚本本身需要3或4毫秒。但是导入

cgi需要95毫秒。 (这是在我的测试系统上的一个PII 300 MHz。

有一种方法可以让它更快吗?导入cgi使脚本在

至少20倍为像mod-python这样的东西是不可能的。我可以在我的测试机器上使用它,但不能在osting提供者处使用它。

解决方案

Cecil Westerhof写道:


我有一个cgi-script dat使用模块cgi,os,sys和time。我用
无法计算导入时间的时间,但是os和sys不需要花费更多的时间。我的脚本本身需要3或4毫秒。但是导入

cgi需要95毫秒。(这是在我的测试系统上一个PII 300 MHz。是否有一个方法可以让这个更快?导入cgi使脚本成为可能在

至少20倍的速度。像mod-python这样的东西是不可能的。我的b $ b可以在我的测试机器上使用它,但不能在osting pro上使用它vider。



托管服务提供商是否支持fastcgi?它也会避免在每次请求时启动

口译员。


Daniele Varrazzo写道:


Cecil Westerhof写道:


>我有一个cgi-script dat使用模块cgi,os,sys和time。 Offcourse
我无法计算导入时间的时间,但os和sys不会花费更多的时间。我的脚本本身需要3或4毫秒。但是导入cgi需要95毫秒。 (这是在我的测试系统上的一个PII 300
MHz。有没有办法让它更快?导入cgi使得
脚本的速度至少慢20倍。像mod-python这样的东西是不是可能的。我可以在我的测试机器上使用它,但不能在osting
提供商处使用。



主机提供商是否支持fastcgi ?它会避免在每次请求时启动

口译员。



我恐怕没有。这是非常裸露的。他们也做不是真的支持

python。(当他们遇到问题时,perl和bash脚本在
天内工作,python脚本必须等待一周和一半。)


我正在考虑改变我的供应商。选择另一个时,要记住什么是重要的事情




" Cecil Westerhof" du *** @dummy.nlescribióenel mensaje

news:45 *********** ********** @ news.xs4all.nl ...

>我有一个cgi-script dat使用模块cgi,os,sys和time。幕后我

无法计算用于导入时间的时间,但os和sys不需要花费更多的时间来计算毫秒数。我的脚本本身需要3或4毫秒。但

导入

cgi需要95毫秒。 (这是在我的测试系统上的一个PII 300 MHz。

有一种方法可以让它更快吗?导入cgi使脚本在

至少20倍为像mod-python这样的东西是不可能的。我可以在我的测试机器上使用它,但不能在osting提供商处使用它。



肯定是os早先导入的,已经加载了.sys是一个内置的
模块。但我认为你的问题不是导入cgi需要多少时间,

但是每次请求启动一个新的python进程需要多长时间。


-

Gabriel Genellina


I have a cgi-script dat uses the modules cgi, os, sys and time. Offcourse I
can not time the time used to import time, but os and sys do not take more
as a millisecond. My script itself takes 3 or 4 milliseconds. But importing
cgi takes 95 milliseconds. (This is on my test system a PII 300 MHz. Is
there a way to make this more fast? The import off cgi makes the script at
least 20 times as slow. Something like mod-python is not a possibility. I
could use it on my test machine, but not at the osting provider.

解决方案

Cecil Westerhof wrote:

I have a cgi-script dat uses the modules cgi, os, sys and time. Offcourse I
can not time the time used to import time, but os and sys do not take more
as a millisecond. My script itself takes 3 or 4 milliseconds. But importing
cgi takes 95 milliseconds. (This is on my test system a PII 300 MHz. Is
there a way to make this more fast? The import off cgi makes the script at
least 20 times as slow. Something like mod-python is not a possibility. I
could use it on my test machine, but not at the osting provider.

Does the hosting provider support fastcgi? It would avoid starting the
interpreter at each request too.


Daniele Varrazzo wrote:

Cecil Westerhof wrote:

>I have a cgi-script dat uses the modules cgi, os, sys and time. Offcourse
I can not time the time used to import time, but os and sys do not take
more as a millisecond. My script itself takes 3 or 4 milliseconds. But
importing cgi takes 95 milliseconds. (This is on my test system a PII 300
MHz. Is there a way to make this more fast? The import off cgi makes the
script at least 20 times as slow. Something like mod-python is not a
possibility. I could use it on my test machine, but not at the osting
provider.


Does the hosting provider support fastcgi? It would avoid starting the
interpreter at each request too.

I am afraid not. It is very bare bone. Also they do not really support
python. (When they had a problem, perl and bash scripts worked within a
day, python scripts had to wait for one and a halve week.)

I am thinking about switching my provider. What are important things to keep
in mind when selecting another one?


"Cecil Westerhof" <du***@dummy.nlescribió en el mensaje
news:45*********************@news.xs4all.nl...

>I have a cgi-script dat uses the modules cgi, os, sys and time. Offcourse I
can not time the time used to import time, but os and sys do not take more
as a millisecond. My script itself takes 3 or 4 milliseconds. But
importing
cgi takes 95 milliseconds. (This is on my test system a PII 300 MHz. Is
there a way to make this more fast? The import off cgi makes the script at
least 20 times as slow. Something like mod-python is not a possibility. I
could use it on my test machine, but not at the osting provider.

Surely os was imported earlier, and was already loaded. sys is a builtin
module. But I think your problem is not how much time takes importing cgi,
but how much time takes launching a new python process on each request.

--
Gabriel Genellina


这篇关于是否有可能加强cgi的导入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆