You make it sound simple...Rebornxeno wrote:How do you find the book your looking for in a library? Maybe the two things aren't much different! :O
Searching
Moderator: Coders of Rage
-
- Chaos Rift Junior
- Posts: 204
- Joined: Mon Nov 21, 2011 3:01 pm
- Current Project: Web browser from scratch
- Favorite Gaming Platforms: SNES, PSP, PS1 and 3
- Programming Language of Choice: C#
- Location: A house near me
- Contact:
Re: Searching
- superLED
- Chaos Rift Junior
- Posts: 303
- Joined: Sun Nov 21, 2010 10:56 am
- Current Project: Engine
- Favorite Gaming Platforms: N64
- Programming Language of Choice: C++, PHP
- Location: Norway
Re: Searching
What, to ask the librarian?Rebornxeno wrote:How do you find the book your looking for in a library? Maybe the two things aren't much different! :O
In the programming world, it would be like asking MySql to find our stuff 8)
- LeonBlade
- Chaos Rift Demigod
- Posts: 1314
- Joined: Thu Jan 22, 2009 12:22 am
- Current Project: Trying to make my first engine in C++ using OGL
- Favorite Gaming Platforms: PS3
- Programming Language of Choice: C++
- Location: Blossvale, NY
Re: Searching
superLED wrote:What, to ask the librarian?Rebornxeno wrote:How do you find the book your looking for in a library? Maybe the two things aren't much different! :O
In the programming world, it would be like asking MySql to find our stuff 8)
Code: Select all
askDatabaseLibrarian("WHERE IS THE ROW FOR THE ONE GUY I WANT");
There's no place like ~/
- superLED
- Chaos Rift Junior
- Posts: 303
- Joined: Sun Nov 21, 2010 10:56 am
- Current Project: Engine
- Favorite Gaming Platforms: N64
- Programming Language of Choice: C++, PHP
- Location: Norway
Re: Searching
Yep, life's easy!LeonBlade wrote:superLED wrote:What, to ask the librarian?Rebornxeno wrote:How do you find the book your looking for in a library? Maybe the two things aren't much different! :O
In the programming world, it would be like asking MySql to find our stuff 8)It's just that easy.Code: Select all
askDatabaseLibrarian("WHERE IS THE ROW FOR THE ONE GUY I WANT");
-
- Chaos Rift Junior
- Posts: 204
- Joined: Mon Nov 21, 2011 3:01 pm
- Current Project: Web browser from scratch
- Favorite Gaming Platforms: SNES, PSP, PS1 and 3
- Programming Language of Choice: C#
- Location: A house near me
- Contact:
Re: Searching
No I mean to actually find the entry in the first place without the help SQL
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Searching
Yeah, I think they were making fun of Rebornxeno's absurd response.tappatekie wrote:No I mean to actually find the entry in the first place without the help SQL
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
-
- Chaos Rift Junior
- Posts: 204
- Joined: Mon Nov 21, 2011 3:01 pm
- Current Project: Web browser from scratch
- Favorite Gaming Platforms: SNES, PSP, PS1 and 3
- Programming Language of Choice: C#
- Location: A house near me
- Contact:
Re: Searching
Ah okay.
I have destroyed the dark cloud that hung over the source files (commenting the code) so now I am developing the first stages of the database overhaul to make searches alot more faster (from advice from this thread)
Thanks
I don't expect the database system to be as good as SQL. But as it will be, everything database related on the site will link to 1 single API which helps the communication with the actual database server with my own protocol.
But if the server becomes slow as we (hopefully) get more users, posts etc, then we will think about using the SQL server and incorporate it with the database API's which will be a great help since we don't need to even touch the site code to convert it to SQL :D
I have destroyed the dark cloud that hung over the source files (commenting the code) so now I am developing the first stages of the database overhaul to make searches alot more faster (from advice from this thread)
Thanks
I don't expect the database system to be as good as SQL. But as it will be, everything database related on the site will link to 1 single API which helps the communication with the actual database server with my own protocol.
But if the server becomes slow as we (hopefully) get more users, posts etc, then we will think about using the SQL server and incorporate it with the database API's which will be a great help since we don't need to even touch the site code to convert it to SQL :D
-
- Chaos Rift Cool Newbie
- Posts: 85
- Joined: Thu Jun 23, 2011 11:12 am
Re: Searching
If you organize the database, searches are pretty fast regardless of its size.
-
- Chaos Rift Junior
- Posts: 204
- Joined: Mon Nov 21, 2011 3:01 pm
- Current Project: Web browser from scratch
- Favorite Gaming Platforms: SNES, PSP, PS1 and 3
- Programming Language of Choice: C#
- Location: A house near me
- Contact:
Re: Searching
How do you mean "organize"?, as in their all sorted?. If so that's all coveredRebornxeno wrote:If you organize the database, searches are pretty fast regardless of its size.
I am working on having the database structured like this
[table identifier token (tells the parser that it's a table) (byte[])][/table]
[column count (byte)][/column]
[entry address (byte[])]
[entry length[])][/entry]
[/entry]
[entry]
[entry1 value(byte[])][/entry]
[entry2 value (byte[])][/entry]
[/entry]
The tags are there for simplicity, they wont be in the actual file. Also the byte[] values for the numeric value types basically allow me to use numbers bigger than 255 (see previous posts for more info)
-
- Chaos Rift Junior
- Posts: 204
- Joined: Mon Nov 21, 2011 3:01 pm
- Current Project: Web browser from scratch
- Favorite Gaming Platforms: SNES, PSP, PS1 and 3
- Programming Language of Choice: C#
- Location: A house near me
- Contact:
Re: Searching
Okay I have looked into BST's a bit more since I am re-writing every system I had (e.g Web Server) to have better performance.
I have come up with this solution to speed up the searching process and note that the search process will take place mainly for finding usernames.
Every circle represents a reference to an entry in the database (index) (or just a link) and every time someone searches it follows these steps
Search Hello
Find H in the global tree root
> Okay found H (is it found? [no])
Find e
> Okay found e from the node list in H
etc....
Oh and by the way, there should also be a link between H and e with the green link as well..
I have'nt began coding it but I believe it will be a faster alternative than a linear search. So if you have believe that this will be as slow then please reply.
I have come up with this solution to speed up the searching process and note that the search process will take place mainly for finding usernames.
Every circle represents a reference to an entry in the database (index) (or just a link) and every time someone searches it follows these steps
Search Hello
Find H in the global tree root
> Okay found H (is it found? [no])
Find e
> Okay found e from the node list in H
etc....
Oh and by the way, there should also be a link between H and e with the green link as well..
I have'nt began coding it but I believe it will be a faster alternative than a linear search. So if you have believe that this will be as slow then please reply.
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Searching
Binary search is most certainly faster than linear search. However, you may want to look into hashed indexes and B-Trees.tappatekie wrote:I have'nt began coding it but I believe it will be a faster alternative than a linear search.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
-
- Chaos Rift Junior
- Posts: 204
- Joined: Mon Nov 21, 2011 3:01 pm
- Current Project: Web browser from scratch
- Favorite Gaming Platforms: SNES, PSP, PS1 and 3
- Programming Language of Choice: C#
- Location: A house near me
- Contact:
Re: Searching
Okay thanks for advice.