Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8459427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:19:39+00:00 2026-06-10T13:19:39+00:00

I am currently calling a C# script file ( http://www.csscript.net ) from a C#

  • 0

I am currently calling a C# script file (http://www.csscript.net) from a C# app in Visual Studio 2010 using this method:

var script = new AsmHelper(CSScript.Load(
             @"C:\temp\CSScriptTest\CSScriptTest\cstest.cs"));
script.Invoke("*.LoopTest");

But I’m noticing that the performance on this is about twice what it takes to call a similar IronPython script using this method:

var ironPythonRuntime = Python.CreateRuntime();
dynamic loadPython = ironPythonRuntime.UseFile(
                     @"C:\temp\IronPythonTest\IronPythonTest\pytest.py");
loadPython.LoopTest();

Is there a method to call a C# script that performs better?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T13:19:41+00:00Added an answer on June 10, 2026 at 1:19 pm

    Here is the answer I got from Oleg Shilo (the creator of CS-Script):

    Actually the performance is the strong point for using CS-Script.

    When it comes to performance it is important to remember the
    difference between IronPython and CS-Script execution model. CS-Script
    (as well as Boo) is relying on CLR and it compiles the script before
    the execution and IronPython is relying on DLR and it interprets the
    scripts during the execution.

    Thus with CS-Script scripts will always be some startup overhead
    associated with the compilation of the script. However after the
    script loaded (compiled) CS-Script demonstrated the best possible
    performance possible for the managed code. This is because at runtime
    the script is no longer a script but an ordinary assembly and the
    performance is identical to the non-scripted scenarios. Thus if you
    have multiple LoopTest calls in your test then the performance
    “picture” will be very different: the loading and the first LoopTest
    call will be relatively slow but the following calls of LoopTest will
    be lightning fast.

    To assist with the startup overhead CS-Script is using a caching
    mechanism (enabled by default) and if the script is not changed since
    the last execution it is not recompiled again but the previous
    compilation result is reused.

    Thus for the best performance:

    screenshot

    • Try (if possible) to avoid modifying the scripts between executions.
    • Use caching via CSScript.CacheEnabled = true (enabled by default)
    • The dispatch style of calls (Invoke(string methodName)) is OK for a single
      call but for multiple calls use either GetStaticMethod or even better
      AlignToInterface. The performance advantage is very significant as
      Invoke in contrast to all other conventions is relying on the
      Reflection. This is the profiling result for the performance.cs sample
      script
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently using this method in calling batch files in vb.net: Private Sub Button3_Click(ByVal
Currently I am calling a title from the database using the below code it
I am currently using osql with nant by calling a batch file with arguments.
I'm working on an audio-intensive app for the iPhone. I'm currently calling a number
html img returned from ajax has class of 'tocrop'. Currently I Calling the function
Hi All I am currently having an issue calling a WCF service from a
I'm using the jquery form plugin ( http://malsup.com/jquery/form/ ) to upload a file via
I am currently using CURL via a php script running as daily cron to
Currently I use this strategy: After submitting a HTML form or data sent using
I have a crontab job calling a python script and outputting to a file:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.