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

  • Home
  • SEARCH
  • 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 8903631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:55:03+00:00 2026-06-15T01:55:03+00:00

I’ve made a simple performance test between EPPlus and Spreadsheet Gear to see if

  • 0

I’ve made a simple performance test between EPPlus and Spreadsheet Gear to see if there is any significant difference that would justify buying Spreadsheet Gear.

I am no expert at either application so it’s possible the tests aren’t written the most efficient way.

The test does the following:
1. Opens an existing Excel-file with 1000 rows and 3 columns. Saves the three values into an entity that is saved into a List<>.
2. Open a new Excel-object
3. Create a header row (bold) with the title of each column.
4. Write back the 1000 entities.
5. Save the new Excelfile.

If I run this test once EPPlus comes out the winner (approx times are EPPlus = 280ms, SG = 500ms). If I run the test 10 times in a row instead (a for-loop opening, copying, saving 10 seperate times) Spreadsheet Gear is faster instead (approx times per file: EPPlus = 165ms, SG = 95ms). For 20 tests the approx times are EPPlus = 160ms / file and SG = 60ms / file.

It seems like (to a certain extent at least) Spreadsheet Gears gets faster and faster the more files I create.
Could anyone explain why EPPlus is the slower one when running consecutive tests? And can I make changes to the code to change this?

EPPlus test function:

var timer = new Stopwatch();
  timer.Start();
  var data = new List<Item>();
  using (var excelIn = new ExcelPackage(new FileInfo(folder + fileIn)))
  {
    var sheet = excelIn.Workbook.Worksheets[1];
    var row = 2;
    while (sheet.Cells[row, 1].Value != null)
    {
      data.Add(new Item()
        {
          Id = int.Parse(sheet.Cells[row, 1].Text),
          Title =  sheet.Cells[row, 2].Text,
          Value = int.Parse(sheet.Cells[row, 3].Text)
        });

      row++;
    }
  }

  using (var excelOut = new ExcelPackage())
  {
    var sheet = excelOut.Workbook.Worksheets.Add("Out");
    sheet.Cells.LoadFromCollection(data);
    sheet.InsertRow(1, 1);
    sheet.Cells[1, 1, 1, 3].Style.Font.Bold = true;
    sheet.Cells[1, 1].Value = "Id";
    sheet.Cells[1, 2].Value = "Title";
    sheet.Cells[1, 3].Value = "Value";

    excelOut.SaveAs(new FileInfo(folder + "EPPlus_" + Guid.NewGuid() + ".xlsx"));
  }

  timer.Stop();
  return timer.ElapsedMilliseconds;

Spreadsheet Gear:

var timer = new Stopwatch();
  timer.Start();

  var data = new List<Item>();
  var excelIn = Factory.GetWorkbook(folder + fileIn);
  var sheetIn = excelIn.Worksheets[0];
  var rowIn = 1;
  while (sheetIn.Cells[rowIn, 0].Value != null)
  {
    data.Add(new Item()
    {
      Id = int.Parse(sheetIn.Cells[rowIn, 0].Text),
      Title = sheetIn.Cells[rowIn, 1].Text,
      Value = int.Parse(sheetIn.Cells[rowIn, 2].Text)
    });

    rowIn++;
  }
  excelIn.Close();

  var excelOut = Factory.GetWorkbook();
  var sheetOut = excelOut.Worksheets.Add();
  sheetOut.Name = "Out";
  var rowOut = 0;
  sheetOut.Cells[rowOut, 0, rowOut, 2].Font.Bold = true;
  sheetOut.Cells[rowOut, 0].Value = "Id";
  sheetOut.Cells[rowOut, 1].Value = "Title";
  sheetOut.Cells[rowOut++, 2].Value = "Value";

  foreach (var item in data)
  {
    sheetOut.Cells[rowOut, 0].Value = item.Id;
    sheetOut.Cells[rowOut, 1].Value = item.Title;
    sheetOut.Cells[rowOut++, 2].Value = item.Value;
  }

  excelOut.SaveAs(folder + "SpreadsheetGear_" + Guid.NewGuid() + ".xlsx", FileFormat.OpenXMLWorkbook);
  excelOut.Close();

  timer.Stop();
  return timer.ElapsedMilliseconds;

Main function

var runs = 1;
  var testerG = new TestSpreadsheetGear();
  var testerE = new TestEpPlus();
  var msE = 0.0;
  var msG = 0.0;
  var i = 0;
  for (i = 0; i < runs; ++i)
  {
    msG += new TestSpreadsheetGear().Run(folder, originalFile);
  }

  for(i = 0; i < runs; ++i)
  {
    msE += new TestEpPlus().Run(folder, originalFile);
  }

  Console.WriteLine("Spreadsheet time: " + msG + ". Per file: " + msG / runs);
  Console.WriteLine("EP Plus time: " + msE + ". Per file: " + msE / runs);
  Console.ReadKey();
  • 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-15T01:55:04+00:00Added an answer on June 15, 2026 at 1:55 am

    I believe that the reason for the results you are seeing is the fact that on the first run the .NET CLR must JIT the code. Since SpreadsheetGear is a complete spreadsheet engine under the hood (as opposed to a read / write library) there is more code to JIT – thus the first run is taking longer for SpreadsheetGear than EPPlus (I am speculating here but have a great deal of experience in benchmarking .NET code over the last 10 years).

    I do not have EPPlus installed but I did write a test which tries to do the same thing you are doing. with SpreadsheetGear 2012 Since I don’t have your starting workbook I first build the workbook. Then, I used more optimal SpreadsheetGear APIs. The first time I run I get 141 milliseconds for SpreadsheetGear 2012. After the first run I get 9 or 10 milliseconds for each run on an overclocked Core i7-980x running Win7 x86 and a release build run without debugger.

    I have pasted my code below (just paste it into a .NET 4.0 C# console application).

    One more thought I have is that this is a very small test case. To really see the performance of SpreadsheetGear 2012 try this with 100,000 rows or even 1 million rows.

    Disclaimer: I own SpreadsheetGear LLC

    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using SpreadsheetGear;
    
    namespace SGvsEPPlus
    {
        class Program
        {
            internal struct Item
            {
                internal Item(int id, string title, int value)
                {
                    Id = id;
                    Title = title;
                    Value = value;
                }
    
                internal int Id;
                internal string Title;
                internal int Value;
            }
    
            static void Test(int rows)
            {
                string filename = @"C:\tmp\MyWorkbook.xlsx";
                Console.Write("Test({0})...", rows);
                var timer = new Stopwatch();
                // Create workbook since we don't have poster's original workbook.
                timer.Restart();
                var workbook = Factory.GetWorkbook();
                var values = (SpreadsheetGear.Advanced.Cells.IValues)workbook.Worksheets[0];
                for (int row = 1; row <= rows; row++)
                {
                    values.SetNumber(row, 0, row);
                    values.SetText(row, 1, "Title " + row);
                    values.SetNumber(row, 2, row * 10);
                }
                Console.Write("Create workbook={0:0}...", timer.Elapsed.TotalMilliseconds);
                // Save workbook
                timer.Restart();
                workbook.SaveAs(filename, FileFormat.OpenXMLWorkbook);
                Console.Write("Save workbook={0:0}...", timer.Elapsed.TotalMilliseconds);
                // Track total time of original test.
                var totalTimer = Stopwatch.StartNew();
                // Open workbook
                timer.Restart();
                var excelIn = Factory.GetWorkbook(filename);
                Console.Write("Open excelIn={0:0}...", timer.Elapsed.TotalMilliseconds);
                // Copy workbook to list
                timer.Restart();
                var sheetIn = excelIn.Worksheets[0];
                var valuesIn = (SpreadsheetGear.Advanced.Cells.IValues)sheetIn;
                var rowIn = 1;
                var data = new List<Item>(rows);
                while (valuesIn[rowIn, 0] != null)
                {
                    data.Add(new Item(
                        (int)valuesIn[rowIn, 0].Number,
                        valuesIn[rowIn, 1].Text,
                        (int)valuesIn[rowIn, 2].Number));
                    rowIn++;
                }
                excelIn.Close(); // Not necessary but left for consistency.
                Console.Write("excelIn->data={0:0}...", timer.Elapsed.TotalMilliseconds);
                timer.Restart();
                var excelOut = Factory.GetWorkbook();
                var sheetOut = excelOut.Worksheets[0];
                var valuesOut = (SpreadsheetGear.Advanced.Cells.IValues)sheetOut;
                sheetOut.Name = "Out";
                var rowOut = 0;
                sheetOut.Cells[rowOut, 0, rowOut, 2].Font.Bold = true;
                sheetOut.Cells[rowOut, 0].Value = "Id";
                sheetOut.Cells[rowOut, 1].Value = "Title";
                sheetOut.Cells[rowOut++, 2].Value = "Value";
                foreach (var item in data)
                {
                    valuesOut.SetNumber(rowOut, 0, item.Id);
                    valuesOut.SetText(rowOut, 1, item.Title);
                    valuesOut.SetNumber(rowOut, 2, item.Value);
                    rowOut++;
                }
                Console.Write("data->excelOut={0:0}...", timer.Elapsed.TotalMilliseconds);
                timer.Restart();
                excelOut.SaveAs(@"C:\tmp\SpreadsheetGear_" + Guid.NewGuid() + ".xlsx", FileFormat.OpenXMLWorkbook);
                excelOut.Close(); // Again - not necessary.
                Console.WriteLine("Save excelOut={0:0}...", timer.Elapsed.TotalMilliseconds);
                Console.WriteLine("    Total={0:0}", totalTimer.Elapsed.TotalMilliseconds);
            }
            static void Main(string[] args)
            {
                // Do it three times with 1000 rows. Note that the first
                // time takes longer because code must be JITted.
                Test(1000);
                Test(1000);
                Test(1000);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
Seemingly simple, but I cannot find anything relevant on the web. What is the
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I

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.