# compileOrc vs compileOrcAsync

**URL:** <https://forum.csound.com/t/compileorc-vs-compileorcasync/1311>\
**Category:** General\
**Created:** [August 17, 2023, 1:29pm UTC](https://forum.csound.com/t/compileorc-vs-compileorcasync/1311 "2023-08-17T13:29:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cordelia](https://forum.csound.com/user_avatar/forum.csound.com/cordelia/32/279_2.png) [@Cordelia](https://forum.csound.com/u/Cordelia)\
**Post date:** [August 17, 2023, 1:29pm UTC](https://forum.csound.com/t/compileorc-vs-compileorcasync/1311/1 "2023-08-17T13:29:04Z")

</div>

Hello,

can someone help me deeply understand the differences between `compileOrcAsync` and `compileOrc` in ctcsound.py API?

For my livecoding system I feel that using `compileOrc` is the best way to send my scores to csound, but the time for csound to execute with `compileOrc` it’s completely unpredictable. Sometimes it’s immediately and sometimes it takes like 2 or 3 seconds. I really cannot figure out what’s the main raison.  
If i use `compileOrcAsync` everything is immediately, but if i send a code where there’s a GEN and some instruments, sometimes the instruments that use this gen are execute before and the results is obviously an error.  
Can someone help me better understand the csound API priorities?  
Thank you,

---

<div class="post-metadata">

**Author:** ![eduardomoguillansky](https://forum.csound.com/user_avatar/forum.csound.com/eduardomoguillansky/32/437_2.png) [@eduardomoguillansky](https://forum.csound.com/u/eduardomoguillansky)\
**Post date:** [September 3, 2023, 11:05am UTC](https://forum.csound.com/t/compileorc-vs-compileorcasync/1311/2 "2023-09-03T11:05:01Z")

</div>

when using a performanceThread, compileOrc will block at least for an entire block. using async will return immediately. In order to ensure that the compilation has taken effect you need to sync to the csound process. See the implementation of sync in csoundengine: [https://github.com/gesellkammer/csoundengine/blob/626760ccf0c4a2309627fb17fd042f2236ce537e/csoundengine/engine.py#L1081C10-L1081C10](https://github.com/gesellkammer/csoundengine/blob/626760ccf0c4a2309627fb17fd042f2236ce537e/csoundengine/engine.py#L1081C10-L1081C10)

It is an involved process and there is definitely room for improvement at the API design level in this regard.
