Route extending Open Rails files
#61
Posted 25 April 2021 - 08:22 AM
#62
Posted 25 April 2021 - 10:13 AM
YoRyan, on 20 April 2021 - 09:59 PM, said:
This comes down to end user convenience vs programmer convenience. I don't think there are any content developers or end users who prefer JSON. They would prefer to have only one familiar format used cohesively across the project. Not to mention the technical limitations of JSON such as:
- more verbose
- more picky about syntax
- can't handle line spanning strings ( such as route descriptions etc )
- lack of a fast loading binary version.
Most of the programmer support for json derives from convenience. Its built into .net with automatic serialization. The problem is this automatic serialization is very slow. It uses code reflection at run time to look at the source and unravel what classes and types need to be loaded. Code reflection is slow. But as you say, there are a lot of fast JSON loading methods and techniques. But using these methods always involves writing a custom serializer for each of your classes. And doing so negates any of the programmer convenience advantages claimed over STF. I realize programmer convenience is important in an understaffed project, but end users and content developers could pay a high price for this convenience.
Wayne
PS my original 2012 JSON speed tests were discussed here.
Source code for test is in the dowload library here
PS Edit
Quote
For my speed comparisons I used actual MSTS data from my L&PS route. I chose .t terrain files, created a JSON format for them, converted all that data to JSON, and measured its effect on route loading time. So it was as real a test case as I could create.
#63
Posted 25 April 2021 - 10:33 AM
But, don't mind me. It's obvious that I'm in the extreme minority here.
#64
Posted 25 April 2021 - 11:00 AM
#65
Posted 25 April 2021 - 11:11 AM
#66
Posted 25 April 2021 - 11:53 AM
If the file is used for input by content developers or end users, then use the STF format. That way there is consistency and familiarity from their point of view.
But files that are primarily internal can be programmer's choice of format. Examples might be eg terrain files, future shape files etc not normally edited by the end user. In choosing these formats programmers might consider loading speed along with programmer convenience.
Wayne
#67
Posted 25 April 2021 - 12:08 PM
- STF for content inherited from MSTS
- STF for paths produced by the Track Viewer
- CSV for timetable files
- (JSON became OR policy beyond this point?)
- JSON for timetable weather files
- STF for animated clocks (in NewYear-MG)
- JSON for animated clocks (in mainline OR, with a converter from STF)
#68
Posted 25 April 2021 - 12:11 PM
YoRyan, on 25 April 2021 - 12:08 PM, said:
- STF for content inherited from MSTS
- STF for paths produced by the Track Viewer
- CSV for timetable files
- (JSON became OR policy beyond this point?)
- JSON for timetable weather files
- STF for animated clocks (in NewYear-MG)
- JSON for animated clocks (in mainline OR, with a converter from STF)
And more.
XML for dynamic track cross section ( I think )
... hence my concerns about consistency
#70
Posted 25 April 2021 - 12:31 PM
wacampbell, on 25 April 2021 - 11:53 AM, said:
If the file is used for input by content developers or end users, then use the STF format. That way there is consistency and familiarity from their point of view.
But files that are primarily internal can be programmer's choice of format. Examples might be eg terrain files, future shape files etc not normally edited by the end user. In choosing these formats programmers might consider loading speed along with programmer convenience. ...
This is what I meant by the categories of "one-way" and "dual-way" files. Maybe I should have better called them
"user->machine" and "machine<->machine" files.
But in any case, for the OR-parsers of possible future STF "user->machine" files, the manpower of developers would be needed again and again - as YoRyan already objected here.
It really seems like a very double-edged problem to me, unfortunately.