# Is there a way to increse startup script exceuction for python?

**URL:** https://forum.alternetsoft.com/t/is-there-a-way-to-increse-startup-script-exceuction-for-python/252
**Category:** AlterNET Studio Support
**Tags:** scripter, python
**Created:** [November 5, 2021, 9:04pm UTC](https://forum.alternetsoft.com/t/is-there-a-way-to-increse-startup-script-exceuction-for-python/252 "2021-11-05T21:04:02Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![audrius](https://forum.alternetsoft.com/letter_avatar_proxy/v4/letter/a/606060/32.png) [@audrius](https://forum.alternetsoft.com/u/audrius)
#### Post date: [November 5, 2021, 9:04pm UTC](https://forum.alternetsoft.com/t/is-there-a-way-to-increse-startup-script-exceuction-for-python/252/1 "2021-11-05T21:04:02Z")

</div>

First I did “pip install arrow” on any existing iron python installation. (it is just sample lib for testing purpose) add them to script engine.  
scriptRun.ScriptSource.ModulesSearchPaths.Add(“C:\IronPython 2.7\Lib”);  
scriptRun.ScriptSource.ModulesSearchPaths.Add(“C:\IronPython 2.7\Lib\site-packages”);

then do script compile and run the run function.  
for code like:  
import arrow  
def run ():  
ff = open(“smth.txt”, “a”)  
ff.write(str(arrow.utcnow())+ ‘\n’);  
ff.close();

It takes very long time to run function for first time. Doing any change to script or just setting flag (ScriptSource.Changed = true;) will cause long compile time again. Is there any possible way to reuse previous part compilation, that startup time would be faster.

I guess it is because of “Jitting”. Every time it starts from scratch jitting everythin even for library that was not changed? Maybe it would be possible to cache resutls? save to dll or smth?

---

<div class="post-metadata">

### Author: ![dmitry.medvedev](https://forum.alternetsoft.com/user_avatar/forum.alternetsoft.com/dmitry.medvedev/32/27_2.png) [@dmitry.medvedev](https://forum.alternetsoft.com/u/dmitry.medvedev)
#### Post date: [November 9, 2021, 1:57am UTC](https://forum.alternetsoft.com/t/is-there-a-way-to-increse-startup-script-exceuction-for-python/252/2 "2021-11-09T01:57:18Z")

</div>

Hi Audrius,

We looked at the problem and indeed it seems to be caused by generating assembly and and running JIT to produce machine code:

> <https://stackoverflow.com/questions/9327606/import-module-in-ironpython-2-7-1-very-slow/9332166#9332166>

This seems to be how IronPython works and I’m not sure we can improve much here.

For your information, we’re going to support running/debugging full Python in the next release:

> **[Technology preview - Python Script Debugger based on Debug Adapter Protocol —...](https://www.alternetsoft.com/blog/python-script-debugger-based-on-debug-adapter-protocol)**
>
> Recently we have released a new version of AlterNET Studio, which supports IronPython scripting/debugging. IronPython as a language is compatible with Python 2.7 and is designed to work with .NET Framework libraries…

Kind regards,  
Dmitry
