Searching

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

tappatekie
Chaos Rift Junior
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

Post by tappatekie »

Rebornxeno wrote:How do you find the book your looking for in a library? Maybe the two things aren't much different! :O
You make it sound simple...
User avatar
superLED
Chaos Rift Junior
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

Post by superLED »

Rebornxeno wrote:How do you find the book your looking for in a library? Maybe the two things aren't much different! :O
What, to ask the librarian?
In the programming world, it would be like asking MySql to find our stuff 8)
User avatar
LeonBlade
Chaos Rift Demigod
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

Post by LeonBlade »

superLED wrote:
Rebornxeno wrote:How do you find the book your looking for in a library? Maybe the two things aren't much different! :O
What, to ask the librarian?
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");
It's just that easy.
There's no place like ~/
User avatar
superLED
Chaos Rift Junior
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

Post by superLED »

LeonBlade wrote:
superLED wrote:
Rebornxeno wrote:How do you find the book your looking for in a library? Maybe the two things aren't much different! :O
What, to ask the librarian?
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");
It's just that easy.
Yep, life's easy!
tappatekie
Chaos Rift Junior
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

Post by tappatekie »

No I mean to actually find the entry in the first place without the help SQL
User avatar
dandymcgee
ES Beta Backer
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

Post by dandymcgee »

tappatekie wrote:No I mean to actually find the entry in the first place without the help SQL
Yeah, I think they were making fun of Rebornxeno's absurd response.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
tappatekie
Chaos Rift Junior
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

Post by tappatekie »

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
Rebornxeno
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 85
Joined: Thu Jun 23, 2011 11:12 am

Re: Searching

Post by Rebornxeno »

If you organize the database, searches are pretty fast regardless of its size.
tappatekie
Chaos Rift Junior
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

Post by tappatekie »

Rebornxeno wrote:If you organize the database, searches are pretty fast regardless of its size.
How do you mean "organize"?, as in their all sorted?. If so that's all covered

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)
tappatekie
Chaos Rift Junior
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

Post by tappatekie »

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.
Image

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.
User avatar
dandymcgee
ES Beta Backer
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

Post by dandymcgee »

tappatekie wrote:I have'nt began coding it but I believe it will be a faster alternative than a linear search.
Binary search is most certainly faster than linear search. However, you may want to look into hashed indexes and B-Trees.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
tappatekie
Chaos Rift Junior
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

Post by tappatekie »

Okay thanks for advice.
Post Reply