Giter VIP home page Giter VIP logo

Comments (2)

jmcnamara avatar jmcnamara commented on May 26, 2024

It shouldn't take anything like a minute to create a 4.5MB file.

Here is a sample program I ran as a test:

#include "xlsxwriter.h"

int main() {

    int max_row = 45000;
    int max_col = 50;

    lxw_workbook  *workbook  = workbook_new("c_perf_test.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    for (int row_num = 0; row_num < max_row; row_num++) {
        for (int col_num = 0; col_num < max_col; col_num++) {
            if (col_num % 2)
                worksheet_write_string(worksheet, row_num, col_num, "Foo", NULL);
            else
                worksheet_write_number(worksheet, row_num, col_num, 12345.0, NULL);

        }
    }

    workbook_close(workbook);

    return 0;
}

I put this in the examples directory of a repo clone and compiled it as follows:

make examples

This runs in around 2.5sec:

$ time ./examples/c_perf_test

real	0m2.424s
user	0m1.945s
sys	0m0.311s

And the output file is ~ 4.5MB:

$ ls -lh c_perf_test.xlsx
-rw-r--r--  1 John  staff   4.6M 23 Dec 10:19 c_perf_test.xlsx

This was on a 3.2 GHz 6-Core Intel Core i7 Mac mini with macOS 14.2.1 (Sonoma).

I'd suggest starting with the same example, verifying the performance, and if it is more or less the same then try to figure out what extra work your program is doing.

from libxlsxwriter.

duncangroenewald avatar duncangroenewald commented on May 26, 2024

Thanks for that. I just looked into it a little more and I have to convert values from strings and the checks to determine the value type seem to be slowing things down. Nothing to do with this library.

from libxlsxwriter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.