Mercurial > hg > octave-nkf
comparison src/ov-cell.cc @ 12005:d3b6e85aaf53 release-3-2-x
fix slow cellstr -> char matrix conversions
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Mon, 22 Jun 2009 09:00:43 +0200 |
parents | 1e640b3de2ad |
children | ea88eece12f5 |
comparison
equal
deleted
inserted
replaced
12004:ff8c445edeb4 | 12005:d3b6e85aaf53 |
---|---|
27 | 27 |
28 #include <iomanip> | 28 #include <iomanip> |
29 #include <iostream> | 29 #include <iostream> |
30 #include <sstream> | 30 #include <sstream> |
31 #include <vector> | 31 #include <vector> |
32 #include <queue> | |
32 | 33 |
33 #include "Array-util.h" | 34 #include "Array-util.h" |
34 #include "byte-swap.h" | 35 #include "byte-swap.h" |
35 #include "lo-utils.h" | 36 #include "lo-utils.h" |
36 #include "quit.h" | 37 #include "quit.h" |
570 | 571 |
571 int n_elts = 0; | 572 int n_elts = 0; |
572 | 573 |
573 octave_idx_type max_len = 0; | 574 octave_idx_type max_len = 0; |
574 | 575 |
576 std::queue<string_vector> strvec_queue; | |
577 | |
575 for (octave_idx_type i = 0; i < nel; i++) | 578 for (octave_idx_type i = 0; i < nel; i++) |
576 { | 579 { |
577 string_vector s = matrix(i).all_strings (); | 580 string_vector s = matrix(i).all_strings (); |
578 | 581 |
579 if (error_state) | 582 if (error_state) |
585 | 588 |
586 octave_idx_type s_max_len = s.max_length (); | 589 octave_idx_type s_max_len = s.max_length (); |
587 | 590 |
588 if (s_max_len > max_len) | 591 if (s_max_len > max_len) |
589 max_len = s_max_len; | 592 max_len = s_max_len; |
590 } | 593 |
591 | 594 strvec_queue.push (s); |
592 retval.resize (n_elts); | 595 } |
596 | |
597 retval = string_vector (n_elts); | |
593 | 598 |
594 octave_idx_type k = 0; | 599 octave_idx_type k = 0; |
595 | 600 |
596 for (octave_idx_type i = 0; i < nel; i++) | 601 for (octave_idx_type i = 0; i < nel; i++) |
597 { | 602 { |
598 string_vector s = matrix(i).all_strings (); | 603 const string_vector s = strvec_queue.front (); |
604 strvec_queue.pop (); | |
599 | 605 |
600 octave_idx_type s_len = s.length (); | 606 octave_idx_type s_len = s.length (); |
601 | 607 |
602 if (s_len) | 608 if (s_len) |
603 { | 609 { |