Repository navigation
Commit e7895ca
committed
Card: test the value type and card image before reading two config items
Reading the value of a card parsed from a header read two configuration
items: Card.value read conf.strip_header_whitespace for every value, and
Card._check_if_rvkc read conf.enable_record_valued_keyword_cards for
every card image. Each read goes through ConfigItem.__get__, which is
slow (see astropy#12504), yet only a str value is stripped and only an image
containing ': ' can be a record-valued keyword card.
Test the type and the image first. Where the config can change the
result it is still read at that moment, so conf.set_temp works as
before. Reading every value of a 412-card header of mostly numbers
does 61 config reads instead of 824 and takes 1.4 ms instead of 2.4 ms.
The value setter and Card.comment are not changed and still read the
config each time.1 parent 7732926 commit e7895ca
3 files changed
Lines changed: 34 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
300 | | - | |
| 300 | + | |
| 301 | + | |
301 | 302 | | |
302 | 303 | | |
303 | 304 | | |
| |||
626 | 627 | | |
627 | 628 | | |
628 | 629 | | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
629 | 635 | | |
630 | 636 | | |
631 | 637 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2397 | 2397 | | |
2398 | 2398 | | |
2399 | 2399 | | |
| 2400 | + | |
| 2401 | + | |
| 2402 | + | |
| 2403 | + | |
| 2404 | + | |
| 2405 | + | |
| 2406 | + | |
| 2407 | + | |
| 2408 | + | |
| 2409 | + | |
| 2410 | + | |
| 2411 | + | |
| 2412 | + | |
| 2413 | + | |
| 2414 | + | |
| 2415 | + | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
| 2422 | + | |
2400 | 2423 | | |
2401 | 2424 | | |
2402 | 2425 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
0 commit comments