Skip to content

add optional parameter suppress_indent to method Design.write_scadnano_file #170

@cgevans

Description

@cgevans

On a large (~3000 strand) scadnano design, writing out a json/scadnano file becomes extremely slow as a result of _SuppressableIndentEncoder (assuming suppress_indent=True), taking up the vast majority of the time, and increasing the time to create the json string from around 1 second to over 20 seconds. For example:

         5086971 function calls (4773439 primitive calls) in 21.794 seconds

   Ordered by: internal time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
    23838   20.359    0.001   20.359    0.001 {method 'replace' of 'str' objects}
        1    0.197    0.197   20.866   20.866 scadnano.py:141(encode)
  1062464    0.164    0.000    0.554    0.000 scadnano.py:4141(<genexpr>)
  1825253    0.152    0.000    0.242    0.000 {built-in method builtins.isinstance}
    16600    0.149    0.000    0.153    0.000 scadnano.py:1474(to_json_serializable)
   201088    0.144    0.000    0.320    0.000 scadnano.py:2922(<listcomp>)
       64    0.089    0.001    0.643    0.010 {built-in method builtins.max}
   201088    0.070    0.000    0.390    0.000 scadnano.py:2920(bound_domains)
215316/119964    0.064    0.000    0.298    0.000 encoder.py:413(_iterencode)
    23839    0.050    0.000    0.050    0.000 encoder.py:204(iterencode)
   330260    0.048    0.000    0.048    0.000 {built-in method _abc._abc_instancecheck}
170638/119948    0.045    0.000    0.262    0.000 encoder.py:277(_iterencode_list)
239778/119964    0.045    0.000    0.279    0.000 encoder.py:333(_iterencode_dict)
   330260    0.043    0.000    0.090    0.000 abc.py:96(__instancecheck__)
  23839/1    0.031    0.000    0.311    0.311 encoder.py:182(encode)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions