Fossil SCM
Performance enhancement for branch name look-ups.
Commit
186405ce3abfe8be99d5106297930ac38c1b86c4
Parent
1bffce5230e5d9f…
1 file changed
+6
-9
+6
-9
| --- src/name.c | ||
| +++ src/name.c | ||
| @@ -143,17 +143,16 @@ | ||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /* "tag:" + symbolic-name */ |
| 146 | 146 | if( memcmp(zTag, "tag:", 4)==0 ){ |
| 147 | 147 | rid = db_int(0, |
| 148 | - "SELECT event.objid" | |
| 148 | + "SELECT event.objid, max(event.mtime)" | |
| 149 | 149 | " FROM tag, tagxref, event" |
| 150 | 150 | " WHERE tag.tagname='sym-%q' " |
| 151 | 151 | " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 " |
| 152 | 152 | " AND event.objid=tagxref.rid " |
| 153 | - " AND event.type GLOB '%q'" | |
| 154 | - " ORDER BY event.mtime DESC /*sort*/", | |
| 153 | + " AND event.type GLOB '%q'", | |
| 155 | 154 | &zTag[4], zType |
| 156 | 155 | ); |
| 157 | 156 | return rid; |
| 158 | 157 | } |
| 159 | 158 | |
| @@ -197,18 +196,17 @@ | ||
| 197 | 196 | if( sqlite3_strnicmp(&zDate[nDate-3],"utc",3)==0 ){ |
| 198 | 197 | zDate[nDate-3] = 'z'; |
| 199 | 198 | zDate[nDate-2] = 0; |
| 200 | 199 | } |
| 201 | 200 | rid = db_int(0, |
| 202 | - "SELECT event.objid" | |
| 201 | + "SELECT event.objid, max(event.mtime)" | |
| 203 | 202 | " FROM tag, tagxref, event" |
| 204 | 203 | " WHERE tag.tagname='sym-%q' " |
| 205 | 204 | " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 " |
| 206 | 205 | " AND event.objid=tagxref.rid " |
| 207 | 206 | " AND event.mtime<=julianday(%Q)" |
| 208 | - " AND event.type GLOB '%q'" | |
| 209 | - " ORDER BY event.mtime DESC /*sort*/ ", | |
| 207 | + " AND event.type GLOB '%q'", | |
| 210 | 208 | zTagBase, zDate, zType |
| 211 | 209 | ); |
| 212 | 210 | return rid; |
| 213 | 211 | } |
| 214 | 212 | |
| @@ -239,17 +237,16 @@ | ||
| 239 | 237 | if( rid ) return rid; |
| 240 | 238 | } |
| 241 | 239 | |
| 242 | 240 | /* Symbolic name */ |
| 243 | 241 | rid = db_int(0, |
| 244 | - "SELECT event.objid" | |
| 242 | + "SELECT event.objid, max(event.mtime)" | |
| 245 | 243 | " FROM tag, tagxref, event" |
| 246 | 244 | " WHERE tag.tagname='sym-%q' " |
| 247 | 245 | " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 " |
| 248 | 246 | " AND event.objid=tagxref.rid " |
| 249 | - " AND event.type GLOB '%q'" | |
| 250 | - " ORDER BY event.mtime DESC /*sort*/ ", | |
| 247 | + " AND event.type GLOB '%q'", | |
| 251 | 248 | zTag, zType |
| 252 | 249 | ); |
| 253 | 250 | if( rid>0 ) return rid; |
| 254 | 251 | |
| 255 | 252 | /* Undocumented: numeric tags get translated directly into the RID */ |
| 256 | 253 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -143,17 +143,16 @@ | |
| 143 | } |
| 144 | |
| 145 | /* "tag:" + symbolic-name */ |
| 146 | if( memcmp(zTag, "tag:", 4)==0 ){ |
| 147 | rid = db_int(0, |
| 148 | "SELECT event.objid" |
| 149 | " FROM tag, tagxref, event" |
| 150 | " WHERE tag.tagname='sym-%q' " |
| 151 | " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 " |
| 152 | " AND event.objid=tagxref.rid " |
| 153 | " AND event.type GLOB '%q'" |
| 154 | " ORDER BY event.mtime DESC /*sort*/", |
| 155 | &zTag[4], zType |
| 156 | ); |
| 157 | return rid; |
| 158 | } |
| 159 | |
| @@ -197,18 +196,17 @@ | |
| 197 | if( sqlite3_strnicmp(&zDate[nDate-3],"utc",3)==0 ){ |
| 198 | zDate[nDate-3] = 'z'; |
| 199 | zDate[nDate-2] = 0; |
| 200 | } |
| 201 | rid = db_int(0, |
| 202 | "SELECT event.objid" |
| 203 | " FROM tag, tagxref, event" |
| 204 | " WHERE tag.tagname='sym-%q' " |
| 205 | " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 " |
| 206 | " AND event.objid=tagxref.rid " |
| 207 | " AND event.mtime<=julianday(%Q)" |
| 208 | " AND event.type GLOB '%q'" |
| 209 | " ORDER BY event.mtime DESC /*sort*/ ", |
| 210 | zTagBase, zDate, zType |
| 211 | ); |
| 212 | return rid; |
| 213 | } |
| 214 | |
| @@ -239,17 +237,16 @@ | |
| 239 | if( rid ) return rid; |
| 240 | } |
| 241 | |
| 242 | /* Symbolic name */ |
| 243 | rid = db_int(0, |
| 244 | "SELECT event.objid" |
| 245 | " FROM tag, tagxref, event" |
| 246 | " WHERE tag.tagname='sym-%q' " |
| 247 | " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 " |
| 248 | " AND event.objid=tagxref.rid " |
| 249 | " AND event.type GLOB '%q'" |
| 250 | " ORDER BY event.mtime DESC /*sort*/ ", |
| 251 | zTag, zType |
| 252 | ); |
| 253 | if( rid>0 ) return rid; |
| 254 | |
| 255 | /* Undocumented: numeric tags get translated directly into the RID */ |
| 256 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -143,17 +143,16 @@ | |
| 143 | } |
| 144 | |
| 145 | /* "tag:" + symbolic-name */ |
| 146 | if( memcmp(zTag, "tag:", 4)==0 ){ |
| 147 | rid = db_int(0, |
| 148 | "SELECT event.objid, max(event.mtime)" |
| 149 | " FROM tag, tagxref, event" |
| 150 | " WHERE tag.tagname='sym-%q' " |
| 151 | " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 " |
| 152 | " AND event.objid=tagxref.rid " |
| 153 | " AND event.type GLOB '%q'", |
| 154 | &zTag[4], zType |
| 155 | ); |
| 156 | return rid; |
| 157 | } |
| 158 | |
| @@ -197,18 +196,17 @@ | |
| 196 | if( sqlite3_strnicmp(&zDate[nDate-3],"utc",3)==0 ){ |
| 197 | zDate[nDate-3] = 'z'; |
| 198 | zDate[nDate-2] = 0; |
| 199 | } |
| 200 | rid = db_int(0, |
| 201 | "SELECT event.objid, max(event.mtime)" |
| 202 | " FROM tag, tagxref, event" |
| 203 | " WHERE tag.tagname='sym-%q' " |
| 204 | " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 " |
| 205 | " AND event.objid=tagxref.rid " |
| 206 | " AND event.mtime<=julianday(%Q)" |
| 207 | " AND event.type GLOB '%q'", |
| 208 | zTagBase, zDate, zType |
| 209 | ); |
| 210 | return rid; |
| 211 | } |
| 212 | |
| @@ -239,17 +237,16 @@ | |
| 237 | if( rid ) return rid; |
| 238 | } |
| 239 | |
| 240 | /* Symbolic name */ |
| 241 | rid = db_int(0, |
| 242 | "SELECT event.objid, max(event.mtime)" |
| 243 | " FROM tag, tagxref, event" |
| 244 | " WHERE tag.tagname='sym-%q' " |
| 245 | " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 " |
| 246 | " AND event.objid=tagxref.rid " |
| 247 | " AND event.type GLOB '%q'", |
| 248 | zTag, zType |
| 249 | ); |
| 250 | if( rid>0 ) return rid; |
| 251 | |
| 252 | /* Undocumented: numeric tags get translated directly into the RID */ |
| 253 |