MySQL++

Check-in [81b6c9452e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:On the mailing list, Dan Grubbs proposed replacing the use of mysqlpp::internal::str_to_lwr() with a tolower() based loop. He says it improves profiling results, but his formulation doesn't do the same thing as the original code, nor in fact apparently anything useful, thus this testing branch. Closed on 2018-07-12 due to lack of input from original poster.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | tolower-speedup
Files: files | file ages | folders
SHA3-256:81b6c9452e45a4e7498daa9736782b990eedfcc04da740f27ca3c200e80a81f5
User & Date: tangent 2017-11-23 01:07:36
Original Comment: (no comment)
Context
2017-11-23
01:07
On the mailing list, Dan Grubbs proposed replacing the use of mysqlpp::internal::str_to_lwr() with a tolower() based loop. He says it improves profiling results, but his formulation doesn't do the same thing as the original code, nor in fact apparently anything useful, thus this testing branch. Closed on 2018-07-12 due to lack of input from original poster. Closed-Leaf check-in: 81b6c9452e user: tangent tags: tolower-speedup
01:06
Added some SSQLSv2 testing files present in previous svn repo but not in tarballs, thus not restored in Fossil conversion, which prevented dtest from running to completion. Since SSQLSv2 has never been completed, this is purely annoying rather than actually important. check-in: 143985738d user: tangent tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to lib/field_names.cpp.

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
..
47
48
49
50
51
52
53
54
55
56
57


58
59
60
61
62
63
64
65
66
67
#include "field_names.h"
#include "result.h"

#include <algorithm>

namespace mysqlpp {

namespace internal { extern void str_to_lwr(std::string& s); }

void
FieldNames::init(const ResultBase* res)
{
	size_t num = res->num_fields();
	reserve(num);

	for (size_t i = 0; i < num; i++) {
................................................................................
	}
}


unsigned int
FieldNames::operator [](const std::string& s) const
{
	std::string temp1(s);
	internal::str_to_lwr(temp1);
	for (const_iterator it = begin(); it != end(); ++it) {
	std::string temp2(*it);


		internal::str_to_lwr(temp2);
		if (temp2.compare(temp1) == 0) {
			return it - begin();
		}
	}

	return end() - begin();
}

} // end namespace mysqlpp







<
<







 







<
<
|
|
>
>
|
|
|
|
|

|



30
31
32
33
34
35
36


37
38
39
40
41
42
43
..
45
46
47
48
49
50
51


52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "field_names.h"
#include "result.h"

#include <algorithm>

namespace mysqlpp {



void
FieldNames::init(const ResultBase* res)
{
	size_t num = res->num_fields();
	reserve(num);

	for (size_t i = 0; i < num; i++) {
................................................................................
	}
}


unsigned int
FieldNames::operator [](const std::string& s) const
{


    for (const_iterator it = begin(); it != end(); ++it) {
        std::string temp(*it);
        const std::string::size_type len = s.length();
        if (len == temp.length()) {
            std::string::size_type i = 0;
            while ((i < len) && (tolower(s[i]) == tolower(temp[i]))) ++i;
            if (i == len) return it - begin();
        }
    }

    return end() - begin();    
}

} // end namespace mysqlpp